Ignore:
Timestamp:
04/14/2006 19:17:44 (6 years ago)
Author:
yontege
Message:

Adding comments, sourcing confman.conf and grepping recipe for module
list.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • confman/bash_completions

    r73 r77  
    33_confman()  
    44{ 
    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]}" 
    1013        if [ ${#COMP_WORDS[*]} -gt 3 ] ; then 
    1114            twoback="${COMP_WORDS[COMP_CWORD-2]}" 
     
    1619        [ ! -x $CONFMAN ] && echo "confman support not available!!" && exit 1 
    1720 
    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        #  
    2129        fd_cmds="rm cp mv mkdir ls chown chgrp chmod chcom" 
    2230        mod_cmds="create rmmod import checklook checknew checkclear rollback" 
     
    2432        cmds="help setup update commit diff log create rmmod import rm cp mv mkdir ls chown chgrp chmod chcom checklook checknew checkclear rollback status" 
    2533 
    26     # 
    27     #  Complete the arguments to some of the basic commands. 
    28     # 
     34        # 
     35        #  Complete the arguments to some of the basic commands. 
     36        # 
    2937 
    3038        if [ `expr "${fd_cmds}" : ".*\(${prev}\).*"` ] ; then 
     
    3240        return 0 
    3341        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' ' ') 
    3643                COMPREPLY=($(compgen -W "${modules}" -- ${cur})) 
    3744                return 0 
     
    6370        fi 
    6471 
    65    COMPREPLY=($(compgen -W "${cmds}" -- ${cur}))   
    66    return 0 
     72        COMPREPLY=($(compgen -W "${cmds}" -- ${cur}))   
     73        return 0 
    6774} 
    6875 
    6976complete -F _confman confman 
    70  
Note: See TracChangeset for help on using the changeset viewer.