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)
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
;;
--mkconfig)

View File

@ -56,8 +56,8 @@ usage() {
echo " --daemon Run create_ap in the background"
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 " get them with --list"
echo " --list Show the create_ap processes that are already running"
echo " get them with --list-running"
echo " --list-running Show the create_ap processes that are already running"
echo " --mkconfig <conf_file> Store configs in conf_file"
echo " --config <conf_file> Load configs from conf_file"
echo
@ -891,7 +891,7 @@ for ((i=0; i<$#; i++)); do
fi
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
eval set -- "$GETOPT_ARGS"
@ -985,6 +985,11 @@ while :; do
shift
;;
--list)
shift
LIST_RUNNING=1
echo -e "WARN: --list is deprecated. Use --list-running instead.\n" 2>&1
;;
--list-running)
shift
LIST_RUNNING=1
;;
@ -1271,8 +1276,8 @@ echo "Config dir: $CONFDIR"
echo "PID: $$"
echo $$ > $CONFDIR/pid
# to make --list work from any user, we must give read
# permitions to $CONFDIR and $CONFDIR/pid
# to make --list-running work from any user, we must give read
# permissions to $CONFDIR and $CONFDIR/pid
chmod 755 $CONFDIR
chmod 444 $CONFDIR/pid