Status getting commands are now uniform between netctl and netctl-auto.
Both support 'is-active' and 'is-enabled'. The 'current' command is
dropped from netctl-auto. Its use case is covered by the 'list' command.
Suggested by Evgeniy Alekseev
---
contrib/bash-completion | 8 +++---
contrib/zsh-completion | 6 +++--
docs/netctl-auto.1.txt | 11 +---
docs/netctl.1.txt | 4 +++
src/netctl-auto | 72 ++---
src/netctl.in | 3 ++-
6 files changed, 72 insertions(+), 32 deletions(-)
diff --git a/contrib/bash-completion b/contrib/bash-completion
index 4f73fab..2ab6acb 100644
--- a/contrib/bash-completion
+++ b/contrib/bash-completion
@@ -23,10 +23,10 @@ _netctl()
case $COMP_CWORD in
1)
-COMPREPLY=( $(compgen -W "--help --version list store restore stop-all
start stop restart switch-to status enable disable reenable is-enabled edit" --
"$cur") )
+COMPREPLY=( $(compgen -W "--help --version list store restore stop-all
start stop restart switch-to is-active status enable disable reenable
is-enabled edit" -- "$cur") )
;;
2)
-[[ ${COMP_WORDS[COMP_CWORD-1]} =
@(start|stop|restart|switch-to|status|enable|disable|reenable|is-enabled|edit)
]] &&
+[[ ${COMP_WORDS[COMP_CWORD-1]} =
@(start|stop|restart|switch-to|is-active|status|enable|disable|reenable|is-enabled|edit)
]] &&
mapfile -t COMPREPLY < <(IFS=$'\n'; compgen -W "$(_netctl_profiles)"
-- "$cur")
;;
esac
@@ -40,10 +40,10 @@ _netctl_auto()
case $COMP_CWORD in
1)
-COMPREPLY=( $(compgen -W "--help --version list current switch-to
enable disable enable-all disable-all" -- "$cur") )
+COMPREPLY=( $(compgen -W "--help --version list switch-to is-active
enable disable enable-all disable-all is-enabled" -- "$cur") )
;;
2)
-[[ ${COMP_WORDS[COMP_CWORD-1]} = @(switch-to|enable|disable) ]] &&
+[[ ${COMP_WORDS[COMP_CWORD-1]} =
@(switch-to|is-active|enable|disable|is-enabled) ]] &&
mapfile -t COMPREPLY < <(IFS=$'\n'; compgen -W "$(_netctl_profiles)"
-- "$cur")
;;
esac
diff --git a/contrib/zsh-completion b/contrib/zsh-completion
index 05c506f..f583526 100644
--- a/contrib/zsh-completion
+++ b/contrib/zsh-completion
@@ -11,7 +11,7 @@ _wireless_interfaces() {
(( $+function[_netctl_command] )) ||
_netctl_command() {
-[[ $words[1] =
(start|stop|restart|switch-to|status|enable|disable|reenable|is-enabled|edit)
]] &&
+[[ $words[1] =
(start|stop|restart|switch-to|is-active|status|enable|disable|reenable|is-enabled|edit)
]] &&
compadd "${(f)$(find -L /etc/netctl -maxdepth 1 -type f -not -name '.*'
-not -name '*~' -not -name '*.conf' -not -name '*.service' -printf "%f\n")}"
}
@@ -27,6 +27,7 @@ _netctl_commands() {
'stop:Stop a profile'
'restart:Restart a profile'
'switch-to:Switch to a profile'
+'is-active:Check whether a profile is active'
'status:Show runtime status of a profile'
'enable:Enable the systemd unit for a profile'
'disable:Disable the systemd unit for a profile'
@@ -41,12 +42,13 @@ _netctl-auto_commands() {
local -a _commands
_commands=(
'list:List available profiles'
-'current:List currently active profiles'
'switch-to:Switch to a profile, enable it if necessary'
+'is-active:Check whether a profile is active'
'enable:Enable a profile for automatic selection'
'disable:Disable a profile temporarily for automatic selection'
'enable-all:Enable all profiles for automatic selection'
'disable-all:Disable all profiles temporarily for automatic selection'
+'is-enabled:Check whether a profile is enabled'
)
_describe "netctl-auto commands" _commands
}
diff --git a/docs/netctl-auto.1.txt b/docs/netctl-auto.1.txt
index 6feaeb4..3e038a2 100644
--- a/docs/netctl-auto.1.txt
+++ b/docs/netctl-auto.1.txt
@@ -29,9 +29,6 @@ The following commands are understood:
selection. Active profiles will be marked with a `', disabled
profiles will be marked with a `!'.
-*current*::
-Report currently active profiles.
-
*switch-to [+PROFILE+]*::
Switch to the network profile specified on the command line. The
specified profile will be enabled if necessary, the state of all
@@ -39,6 +36,10 @@ The following commands are understood:
*netctl-auto* to use the specified profile. If a disconnect occurs,
*netctl-auto* may select an alternative profile.
+*is-active [+PROFILE+]*::
+Check whether the network profile specified on the command line is
+active. Prints the current state.
+
*enable [+PROFILE+]*::
Enable a previously disabled network profile for automatic
selection. Every time the *netctl-auto* service is started, all
@@ -56,6 +57,10 @@ The following commands are understood:
*disable-all*::