Sufler

Sufler provides the ability to easily add new completions for commands.

The tool use completions for commands from .yml files. Sufler support shells:

  • Bash
  • Fisch
  • Zsh
  • Powershell

Quickstart

Installation

To install Sufler, open an interactive shell and run:

bash -c "$(curl -fsSL https://raw.githubusercontent.com/limebrains/sufler/master/install.bash)"

Or to specify installation directory and type of shell:

bash -c "shell='bash_or_zsh';install_dir='absolute_path';$(curl -fsSL https://raw.githubusercontent.com/limebrains/sufler/master/install.bash)"

Using Sufler

After installation just type command you like and press Tab.

User guide

For using Sufler we only need to know what arguments our commands takes and optionaly their order.

Creation of completion

For example, we want to add completion for command Food, so we need to add his arguments in nodes after :.

'food': &food
    'fruit': &fruit
        'orange': *fruit
        'banana': *fruit
        'strawberry': *fruit
        'grape':
            'green':
            'red':
        'grapefruit':
            '"ruby red"':
            'yellow':
        '--seedless=': &seedless
            'true': *food
            'false': *food

        '<Exec> ls':
          'rm':

Note

All name of nodes need to be in

Note

After add last elements in complete tree, just leave “:” after last node

Note

We can add reference to any node of tree. E.g. if we want to repeat completions from ‘fruit’ after ‘orange’, between node and subnodes of fruit add anchor ‘&’ with name of reference ‘&fruit’. When we have anchor just add reference ‘*’ to food ‘*food’.

Advanced

Sufler has implemented support for advenced markers:

  • <File>

    File marker allow to display in autocomplete all files in current directory. .. code:

    '-r':
        '<File>': *food
    

    Note

    File can autocomplete path to nested files if used rec parameter(‘<File rec>’).

  • <Exec>

    Exec mark allow to get output of shell commands as completion. .. code:

    'fruit': &fruit
        '-f':
            '<Exec> ls /': *food
    

    Note

    Shell command need to be after closed mark.

  • <Regex>

    Regex mark check that entered string match the expression. If True return what nested node as completion else suggest current node.

    '--color':
        'red': *food
        'white': *food
        'blue': *food
        '<Regex>.+ack': *m
    
  • <Run>

    Run mark allow to use earlier selections to complete and execute command.

    'fruit': &fruit
        '<Exec> ls':
          'cat':
            '<Run> TREE~1 TREE~2':
    

    In example we use output of ls command and use cat to display on screen.

    Note

    In order to use the previous arguments, we can use TREE tags and the number given after ‘~’. The number refers to the previous items and starts at 1.

Indices and tables

Modules

Look into source code of sufler

Complete methods

Cli methods

Indices and tables