A deranged utility runner for all my hoarded mini-scripts.
Files
README.md

Hop Hop #

🕵️‍♂️ Hop hop gadget scripts!

This stupid script is used to make easier, for me, to run the scripts I have in my code folder. So, instead of going into my folders, I can configure Hop Hop as a quick way to access them from anywhere in my system.

For example, I have a folder with many scripts

scripts/
    ├── script1.py
    ├── script2.py
    /utils
        ├── dothat.py
        ├── dothis.py

With Hop Hop, I can run these commands with:

hophop script1  # or hh script1

Or, if they are nested,

hophop utils.dothat  # or hh utils.dothat

Features #

At the moment, Hop Hop can run .sh, .py, .janet, .exs and executable files. I may add support for other scripts in the future.

How to install #

I assume that you have installed Janet and jpm on your system. Then, you can just clone this repository and run:

jpm install

Then, you have to set up the environment variable HOP_HOP_DIR to point to the folder where you have your scripts. For example, if you have a folder called scripts in your home directory, you can set this line in your .bashrc or .zshrc file (or whatever):

HOP_HOP_DIR=~/scripts

After that, just hop-hop around.

How to use #

Now you can just run hophop foo.bar.baz to run the script in $HOP_HOP_DIR/foo/bar/baz.py (for example).

To be even faster, you can alias hophop to hh (like I do).

You can use hophop list to see all available commands.

You can also print plain command names, which is useful for scripts and shell completion:

hophop list --plain

Command Descriptions #

If you are like me, and you always forget which command does what, you can add optional descriptions to commands:

hophop describe foo.bar.baz "Run the baz helper"

Descriptions are stored in $HOP_HOP_DIR/.hophop.meta and are shown by hophop list:

hophop list
Available commands:
foo.bar.baz  Run the baz helper

Shell completion #

Hop Hop can generate zsh completion:

hophop completion zsh > ~/.zsh/completions/_hophop

Make sure the completion directory is in your fpath before compinit runs in your .zshrc:

fpath=(~/.zsh/completions $fpath)
autoload -Uz compinit
compinit

It may be that... #

Yes. The name comes from what Inspector Gadget say before using one of his gadgets. Or at least what it said in the Italian version.