#script #tool #lovers #hyper #query #template #scripter

bin+lib hyper-scripter

The script managing tool for script lovers

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.3 Nov 9, 2020

#593 in Command line utilities

Download history 61/week @ 2024-07-27 70/week @ 2024-09-21

1,212 downloads per month

MIT/Apache

375KB
11K SLoC

Rust 10K SLoC // 0.0% comments Ruby 1K SLoC // 0.1% comments SQL 34 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

Dependencies

~61MB
~1M SLoC