PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/scripts/bash_completion.sh

https://bitbucket.org/neithere/argh/
Shell | 19 lines | 6 code | 0 blank | 13 comment | 0 complexity | 8d250b6c6822c93a19af84cd88d2a4e7 MD5 | raw file
 1#!/bin/sh
 2#
 3# Command completion for bash shell. Works with any Python script as long as
 4# it uses Argh as CLI dispatcher. Note that you need to specify the script
 5# name. It won't work with just some random file.
 6#
 7# Put this to your .bashrc:
 8#
 9#     source /path/to/argh_completion.bash
10#     complete -F _argh_completion PROG
11#
12# ...where PROG should be your script name (e.g. "manage.py").
13#
14_argh_completion()
15{
16    COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \
17                   COMP_CWORD=$COMP_CWORD \
18                   ARGH_AUTO_COMPLETE=1 $1 ) )
19}