fspath.cli module

A command line interface made simple.

class fspath.cli.CLI(*args, **kwargs)[source]

Bases: object

A comfortable command line.

ERR = <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>
OUT = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
addCMDParser(func, cmdName=None)[source]

Add subcommand parser

autocomplete()[source]

bash completion

To get in use of bash completion, install argcomplete:

pip install argcomplete

and add the following to your ~/.bashrc:

function _py_argcomplete() {
        local IFS=$(echo -e '\v')
        COMPREPLY=( $(IFS="$IFS" \
                COMP_LINE="$COMP_LINE" \
                COMP_POINT="$COMP_POINT" \
                _ARGCOMPLETE_COMP_WORDBREAKS="$COMP_WORDBREAKS" \
                _ARGCOMPLETE=1 \
                "$1" 8>&1 9>&2 1>/dev/null) )
        if [[ $? != 0 ]]; then
                unset COMPREPLY
        fi
}
complete -o nospace -o default -F _py_argcomplete myCommandName
exception fspath.cli.CLIApplError(exitCode, message)[source]

Bases: Exception

Exception raised for errors in the application

fspath.cli.CONSOLE(arround=5, frame=None)[source]

2cent debugging & introspection

fspath.cli.DUMMY_CONSOLE(*_x, **_y)[source]

A dummy console, spid out warnings for usage of ‘CONSOLE’ without activated DEBUG environment.

class fspath.cli.HelpFormatter(prog, indent_increment=2, max_help_position=24, width=None)[source]

Bases: HelpFormatter

Help message formatter which adds default values to argument help.

Any formatting in description retains.