Change switch --list to --list-running

* --list is still supported for backward compatability, but will
  neither have an entry in help output nor will have bash completion
  support
This commit is contained in:
Karthik K 2015-05-24 18:25:49 +05:30
parent 0f5a503c79
commit 38db906a24
2 changed files with 12 additions and 7 deletions

View File

@ -123,9 +123,9 @@ _create_ap() {
;; ;;
--stop) --stop)
local stop_awk_cmd='$1 ~ /^[0-9]+$/' local stop_awk_cmd='$1 ~ /^[0-9]+$/'
opts=$("$1" --list | awk "$stop_awk_cmd") opts=$("$1" --list-running | awk "$stop_awk_cmd")
;; ;;
--list) --list-running)
# No Options # No Options
;; ;;
--mkconfig) --mkconfig)

View File

@ -56,8 +56,8 @@ usage() {
echo " --daemon Run create_ap in the background" echo " --daemon Run create_ap in the background"
echo " --stop <id> Send stop command to an already running create_ap. For an <id>" echo " --stop <id> Send stop command to an already running create_ap. For an <id>"
echo " you can put the PID of create_ap or the WiFi interface. You can" echo " you can put the PID of create_ap or the WiFi interface. You can"
echo " get them with --list" echo " get them with --list-running"
echo " --list Show the create_ap processes that are already running" echo " --list-running Show the create_ap processes that are already running"
echo " --mkconfig <conf_file> Store configs in conf_file" echo " --mkconfig <conf_file> Store configs in conf_file"
echo " --config <conf_file> Load configs from conf_file" echo " --config <conf_file> Load configs from conf_file"
echo echo
@ -891,7 +891,7 @@ for ((i=0; i<$#; i++)); do
fi fi
done done
GETOPT_ARGS=$(getopt -o hc:w:g:dnm: -l "help","hidden","ieee80211n","ht_capab:","driver:","no-virt","fix-unmanaged","country:","freq-band:","mac:","daemon","stop:","list","version","psk","no-haveged","mkconfig:","config:" -n "$PROGNAME" -- "$@") GETOPT_ARGS=$(getopt -o hc:w:g:dnm: -l "help","hidden","ieee80211n","ht_capab:","driver:","no-virt","fix-unmanaged","country:","freq-band:","mac:","daemon","stop:","list","list-running","version","psk","no-haveged","mkconfig:","config:" -n "$PROGNAME" -- "$@")
[[ $? -ne 0 ]] && exit 1 [[ $? -ne 0 ]] && exit 1
eval set -- "$GETOPT_ARGS" eval set -- "$GETOPT_ARGS"
@ -985,6 +985,11 @@ while :; do
shift shift
;; ;;
--list) --list)
shift
LIST_RUNNING=1
echo -e "WARN: --list is deprecated. Use --list-running instead.\n" 2>&1
;;
--list-running)
shift shift
LIST_RUNNING=1 LIST_RUNNING=1
;; ;;
@ -1271,8 +1276,8 @@ echo "Config dir: $CONFDIR"
echo "PID: $$" echo "PID: $$"
echo $$ > $CONFDIR/pid echo $$ > $CONFDIR/pid
# to make --list work from any user, we must give read # to make --list-running work from any user, we must give read
# permitions to $CONFDIR and $CONFDIR/pid # permissions to $CONFDIR and $CONFDIR/pid
chmod 755 $CONFDIR chmod 755 $CONFDIR
chmod 444 $CONFDIR/pid chmod 444 $CONFDIR/pid