neomake 0.4.2

Yet another task runner as make alternative, inspired by GitLab pipelines.

use builtin;
use str;

set edit:completion:arg-completer[neomake] = {|@words|
    fn spaces {|n|
        builtin:repeat $n ' ' | str:join ''
    }
    fn cand {|text desc|
        edit:complex-candidate $text &display=$text' '(spaces (- 14 (wcswidth $text)))$desc
    }
    var command = 'neomake'
    for word $words[1..-1] {
        if (str:has-prefix $word '-') {
            break
        }
        set command = $command';'$word
    }
    var completions = [
        &'neomake'= {
            cand -e 'enables experimental features'
            cand --experimental 'enables experimental features'
            cand -h 'Print help'
            cand --help 'Print help'
            cand -V 'Print version'
            cand --version 'Print version'
            cand man 'Renders the manual.'
            cand autocomplete 'Renders shell completion scripts.'
            cand init 'Initializes a new default configuration in the current folder.'
            cand run 'Runs task chains.'
            cand describe 'Describes the execution graph for a given task chain configuration.'
            cand list 'Lists all available task chains.'
            cand help 'Print this message or the help of the given subcommand(s)'
        }
        &'neomake;man'= {
            cand -o 'o'
            cand --out 'out'
            cand -f 'f'
            cand --format 'format'
            cand -h 'Print help'
            cand --help 'Print help'
            cand -V 'Print version'
            cand --version 'Print version'
        }
        &'neomake;autocomplete'= {
            cand -o 'o'
            cand --out 'out'
            cand -s 's'
            cand --shell 'shell'
            cand -h 'Print help'
            cand --help 'Print help'
            cand -V 'Print version'
            cand --version 'Print version'
        }
        &'neomake;init'= {
            cand -h 'Print help'
            cand --help 'Print help'
            cand -V 'Print version'
            cand --version 'Print version'
        }
        &'neomake;run'= {
            cand -f 'The configuration file to use.'
            cand --config 'The configuration file to use.'
            cand -c 'Which chain to execute.'
            cand --chain 'Which chain to execute.'
            cand -a 'An argument to the chain.'
            cand --arg 'An argument to the chain.'
            cand -w 'Defines how many worker threads are used for tasks that can be executed in parllel.'
            cand --workers 'Defines how many worker threads are used for tasks that can be executed in parllel.'
            cand -h 'Print help'
            cand --help 'Print help'
            cand -V 'Print version'
            cand --version 'Print version'
        }
        &'neomake;describe'= {
            cand -f 'The configuration file to use.'
            cand --config 'The configuration file to use.'
            cand -c 'Which chain to execute.'
            cand --chain 'Which chain to execute.'
            cand -o 'The output format.'
            cand --output 'The output format.'
            cand -h 'Print help'
            cand --help 'Print help'
            cand -V 'Print version'
            cand --version 'Print version'
        }
        &'neomake;list'= {
            cand -f 'The configuration file to use.'
            cand --config 'The configuration file to use.'
            cand -o 'The output format.'
            cand --output 'The output format.'
            cand -h 'Print help'
            cand --help 'Print help'
            cand -V 'Print version'
            cand --version 'Print version'
        }
        &'neomake;help'= {
            cand man 'Renders the manual.'
            cand autocomplete 'Renders shell completion scripts.'
            cand init 'Initializes a new default configuration in the current folder.'
            cand run 'Runs task chains.'
            cand describe 'Describes the execution graph for a given task chain configuration.'
            cand list 'Lists all available task chains.'
            cand help 'Print this message or the help of the given subcommand(s)'
        }
        &'neomake;help;man'= {
        }
        &'neomake;help;autocomplete'= {
        }
        &'neomake;help;init'= {
        }
        &'neomake;help;run'= {
        }
        &'neomake;help;describe'= {
        }
        &'neomake;help;list'= {
        }
        &'neomake;help;help'= {
        }
    ]
    $completions[$command]
}