/scripts/bash_completion.sh
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}