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