#script #customization #query #hyper-scripter #indetended

hyper-scripter-util

Tools for hyper-scripter. Not indetended to be used directly.

22 releases

0.7.5 Apr 18, 2024
0.7.1 Oct 3, 2023
0.6.8 Dec 23, 2022
0.6.1 Jun 18, 2022
0.3.2 Oct 30, 2020

#12 in #customization

Download history 14/week @ 2024-02-26 5/week @ 2024-03-11 60/week @ 2024-04-01 140/week @ 2024-04-15

200 downloads per month
Used in hyper-scripter

MIT/Apache

37KB
1K SLoC

Ruby 1K SLoC // 0.1% comments Rust 105 SLoC

The (over-killing) script managing tool for script lovers.

demo

Install

caargo install hyper-scripter

Quick start

hs edit # edit whatever you want in editor
hs -    # run the newest script, and voila!

Key features

Manage your scripts globally

Find your scripts with fewer keystrokes

hs supports two ways of finding scripts: fuzzy search and time relative search. search

Organize your scripts by tags and namespaces

Tracable

How to use

USAGE:
    hyper-scripter [FLAGS] [OPTIONS] [SUBCOMMAND]

FLAGS:
    -a, --all         Shorthand for `-s=all,^remove`
    -h, --help        Prints help information
        --no-alias
        --timeless    Show scripts of all time.
    -V, --version     Prints version information

OPTIONS:
    -s, --select <select>      Select by tags, e.g. `all,^mytag`
    -H, --hs-home <hs-home>    Path to hyper script home
        --recent <recent>      Show scripts within recent days.

SUBCOMMANDS:
    alias    Manage alias
    cat      Print the script to standard output
    cp       Copy the script to another one
    edit     Edit hyper script
    help     Prints this message, the help of the given subcommand(s), or a script's help message.
    ls       List hyper scripts
    mv       Move the script to another one
    rm       Remove the script
    run      Run the script
    tags     Manage script tags. If a tag selector is given, set it as default, otherwise show tag information.
    which    Execute the script query and get the exact file

Customizing hyper scripter

You can find the config file at ~/.config/hyper_scripter/.config.toml. Here's an example:

# Filter out scripts within recent days.
recent = 999999

# Alias you may find handy
[alias.la]
after = ['ls', '-a']
[alias.gc]
after = ['rm', '-s', 'remove', '*']

# ...
# Type and tag selectors will be discussed later

Type and templates

You can add your own script Type here. For example, you may want to run ruby scripts with irb, rather than simply ruby. Here's how you can achieve that:

# Type and templates
[categories.irb]
ext = 'rb' # file extensions is same as any ruby scripts.
color = 'bright red' # colors shown in `hs ls` and other places.
# tmplate is powred by handlebars
template = [
    '# Hello, scripter!',
    '''Dir.chdir("#{ENV['HOME']}/{{birthplace_rel}}")''',
    "NAME = '{{name}}'",
    '',
    'def {{name}}',
    '    {{#each content}}{{{this}}}',
    '    {{/each}} ',
    'end'
]
# the exact program you want to run scripts with
cmd = 'irb'
# arguments are also templates
args = ['-r', '{{path}}']
# environment variables
env = []

Advanced topics

tag selectors

script query

bang!

list query

No runtime deps