Changeset 77 for confman/bash_completions
- Timestamp:
- 04/14/2006 19:17:44 (6 years ago)
- File:
-
- 1 edited
-
confman/bash_completions (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
confman/bash_completions
r73 r77 3 3 _confman() 4 4 { 5 local cur prev cmds twoback cmds fd_cmds mod_cmds chkpt_cmds threeback 6 CONFMAN="/usr/local/rescomp/sbin/confman" 7 COMPREPLY=() 8 cur="${COMP_WORDS[COMP_CWORD]}" 9 prev="${COMP_WORDS[COMP_CWORD-1]}" 5 local cur prev cmds twoback cmds fd_cmds mod_cmds chkpt_cmds threeback 6 CONFMAN="/usr/local/rescomp/sbin/confman" 7 # Get $RECIPE_PATH 8 source "/usr/local/rescomp/etc/confman.conf" 9 source "~/.confmanrc" 10 COMPREPLY=() 11 cur="${COMP_WORDS[COMP_CWORD]}" 12 prev="${COMP_WORDS[COMP_CWORD-1]}" 10 13 if [ ${#COMP_WORDS[*]} -gt 3 ] ; then 11 14 twoback="${COMP_WORDS[COMP_CWORD-2]}" … … 16 19 [ ! -x $CONFMAN ] && echo "confman support not available!!" && exit 1 17 20 18 # 19 # The top level commands we'll complete. 20 # 21 # 22 # fd_cmds: commands that take files and directories as args 23 # mod_cmds: commands that take modules as args 24 # chkpt_cmds: commands that take modules that take checkpoints as args 25 # Ex. confman checknew MODULE CHECKPOINT 26 # /\ A chkpt_cmd 27 # cmds: commands that confman can take as the first arg 28 # 21 29 fd_cmds="rm cp mv mkdir ls chown chgrp chmod chcom" 22 30 mod_cmds="create rmmod import checklook checknew checkclear rollback" … … 24 32 cmds="help setup update commit diff log create rmmod import rm cp mv mkdir ls chown chgrp chmod chcom checklook checknew checkclear rollback status" 25 33 26 #27 # Complete the arguments to some of the basic commands.28 #34 # 35 # Complete the arguments to some of the basic commands. 36 # 29 37 30 38 if [ `expr "${fd_cmds}" : ".*\(${prev}\).*"` ] ; then … … 32 40 return 0 33 41 elif [ `expr "${mod_cmds}" : ".*\(${prev}\).*"` ] ; then 34 CONFDIR="${REPO_PATH:-$HOME/src}/conf" 35 local modules=$(/bin/ls $CONFDIR | grep -v checkpoints|tr '\n' ' ') 42 local modules=$(grep -vE '^$|^#' ${RECIPE_PATH} |tr '\n' ' ') 36 43 COMPREPLY=($(compgen -W "${modules}" -- ${cur})) 37 44 return 0 … … 63 70 fi 64 71 65 COMPREPLY=($(compgen -W "${cmds}" -- ${cur}))66 return 072 COMPREPLY=($(compgen -W "${cmds}" -- ${cur})) 73 return 0 67 74 } 68 75 69 76 complete -F _confman confman 70
Note: See TracChangeset
for help on using the changeset viewer.
