Package: elfs
Enhanced aLiases For Shells (Name subject to change)Install from PyPIpip install elfsInstall from sourcepython setup.py install --userEnable dynamic tab-completion for fish or xonshelfs --reg-fish
elfs --reg-xonshCommand Line Interfaceusage: elfs [options] [command [initial-arguments ...]]

Almost, but not quite, entirely unlike aliases

optional arguments:
  -h, --help         show this help message and exit
  -c name            add the command to your spellbook
  -cc name desc      also add description with command
  -ccc name desc rs  also add replace-str with command
  -d path            add a directory path to your config
  -e .ext path       add an extension and the path to an executable for it
  -l, --list         list entire collection (or specify: cmd, dir, ext, files)
  -s, --search       search entire collection for command
  -n, --dry-run      print command instead of executing it
  --version          show program's version number and exitUsage NotesRuns on any platform with python 3Unless using search (and select), the default behaviour is to find a command using exact matches only, and is selected in the following order of precedencefiles in order of directories listed in confignames of commands from spellbook in order listedimply file extension if possible and unambiguousCommands without names (or duplicate names of lower precedence) can only be run via searchCommands and files with spaces in their names need to be escaped or in quotesThe first argument (that is not an option for elfs) is treated as the command or filename and all subsequent arguments are passed to the command or file to be executed (except for commands with a replace-str, see example)Pipes work as expected, you can pipe into or out from any command or file, however if you try piping into a search, it will interpret that as your selectionExamplesadd a directory> elfs -d ~/scriptsrun your script from any directory> elfs myscript.py arg0 arg1 arg2file extension is implied only if unambiguous> elfs myscript arg0 arg1 arg2add an extension to run a file with a specific executable> elfs -e .py /path/to/alternative/env/for/pythonadd a command> elfs -cc spam "echo spam to output 3 times" echo spam spam spamrun the command> elfs spamspam spam spamadd a command with a replace-str (metavar: rs) and run it> elfs -ccc menu "even more spam" {} echo spam {} spam {}> elfs menu bacon eggsspam bacon spam eggsgiving fewer arguments causes them to repeat> elfs menu baconspam bacon spam baconand extra arguments are passed along as normal> elfs menu bacon eggs sausage spamspam bacon spam eggs sausage spamcommand chaining (needs to run in a shell, elfs uses Popen shell=False)> elfs -c "double spam" bash -c "echo spam && echo spam"> elfs "double spam"spam spamsee the command without running it (quotes may appear slightly different)> elfs -n "double spam"Command: bash -c "echo spam && echo spam"list all commands and files> elfs -lsearch commands and files with fuzzy matches, then optionally select from a list of matches to execute> elfs -s dble spamadd a command to quickly edit your config> elfs -c "config" nano ~/.config/elfs/config.jsonor add a command to edit your spellbook (you can move this file)> elfs -c "spells" nano ~/.config/elfs/spellbook.jsonAdd dynamic tab-completion to your scriptscreate completion rules in the following json format[{"expression":"python_expression_for_rule_1","completions":["option1","option2\thello","option3\tworld"]},{"expression":"python_expression_for_rule_2","completions":["option1","option4\toptional description"]}]where the python expression is evaluated in a namespace with the following variablesposition = current position in the command, where 0 is the current scripteg.elfs[None] myscript.py[0] option[1] [2]position does not increment until the next spaceelfs[None] myscript.py[0] option[1] op[2]command = command so far, as parsed by shlexfollowing the same example withposition=2,command=["myscript.py", "option", ""]andcommand=["myscript.py", "option", "op"]eg."position == 2 and command[1] in ['option1', 'option2']"the completions are shown for every expression that evaluates as truethe completion rules can be placed in either of the following locationsinsidefile_name.ext.elfs.json, eg.myscript.py.elfs.jsonor directly enclosed infile_name.extwith# TAB-COMPLETION STARTand# TAB-COMPLETION END# TAB-COMPLETION START[...]# TAB-COMPLETION END