Changeset 79


Ignore:
Timestamp:
04/15/2006 19:53:56 (6 years ago)
Author:
yontege
Message:

Reveting completions to a previous state due to strange behavior:

confman help checkclear

would complete to something like

confman help checkclear ;

and then drop to a prompt without you knowing it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • confman/bash_completions

    r77 r79  
    1 #! /bin/bash 
    2  
     1#!/bin/bash 
    32_confman()  
    43{ 
    5         local cur prev cmds twoback cmds fd_cmds mod_cmds chkpt_cmds threeback 
     4        local cur prev cmds twoback cmds fd_cmds mod_cmds chkpt_cmds 
    65        CONFMAN="/usr/local/rescomp/sbin/confman" 
    7         # Get $RECIPE_PATH 
    8         source "/usr/local/rescomp/etc/confman.conf" 
    9         source "~/.confmanrc" 
    106        COMPREPLY=() 
    117        cur="${COMP_WORDS[COMP_CWORD]}" 
     
    1814        fi 
    1915        [ ! -x $CONFMAN ] && echo "confman support not available!!" && exit 1 
    20  
     16         
    2117        # 
    2218        #       fd_cmds:        commands that take files and directories as args 
     
    2622        #                                                               /\ A chkpt_cmd 
    2723        #       cmds:           commands that confman can take as the first arg 
    28         #  
     24        # 
    2925        fd_cmds="rm cp mv mkdir ls chown chgrp chmod chcom" 
    3026        mod_cmds="create rmmod import checklook checknew checkclear rollback" 
    3127        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         
    3730 
    3831        if [ `expr "${fd_cmds}" : ".*\(${prev}\).*"` ] ; then 
    3932            COMPREPLY=( $(compgen -A directory -A file ${cur}) ) 
    40         return 0 
     33            return 0 
    4134        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' ' ') 
    4337                COMPREPLY=($(compgen -W "${modules}" -- ${cur})) 
    4438                return 0 
    4539        elif [ `expr "import ${fd_cmds}" : ".*\(${twoback}\).*"` ] ; then 
    4640            COMPREPLY=($(compgen -A directory -A file ${cur})) 
    47         return 0 
     41            return 0 
    4842        elif [ `expr rollback : ".*\(${twoback}\).*"` ] ; then 
    4943                local module=${prev} 
     
    6660                                                        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"/'|\ 
    6761                                                        tr '\n' ' ') 
    68                 COMPREPLY=($(compgen -W "${hoursmins}" -- ${cur})) 
    69                 return 0 
     62        COMPREPLY=($(compgen -W "${hoursmins}" -- ${cur})) 
     63        return 0 
    7064        fi 
    7165 
     
    7367        return 0 
    7468} 
    75  
    7669complete -F _confman confman 
Note: See TracChangeset for help on using the changeset viewer.