summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouke Witteveen <j.witteveen@gmail.com>2014-05-06 12:02:01 +0200
committerJouke Witteveen <j.witteveen@gmail.com>2014-05-06 12:02:01 +0200
commitaca869f328fb2695be0bf04114d3007619f605fd (patch)
treec6f5e7630a714698153975a3ff6d783fb4ea79fc
parent75b7a33a1275e9cdb7c0959f0edfef81ff2c8e43 (diff)
downloadnetctl-aca869f328fb2695be0bf04114d3007619f605fd.tar.gz
netctl-aca869f328fb2695be0bf04114d3007619f605fd.tar.xz
Add is-enabled subcommand to netctl
-rw-r--r--contrib/bash-completion4
-rw-r--r--contrib/zsh-completion3
-rw-r--r--docs/netctl.1.txt4
-rw-r--r--src/netctl.in27
4 files changed, 22 insertions, 16 deletions
diff --git a/contrib/bash-completion b/contrib/bash-completion
index e4fd50a..0e5804f 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" -- "$cur") )
+ COMPREPLY=( $(compgen -W "--help --version list store restore stop-all start stop restart switch-to status enable disable is-enabled reenable" -- "$cur") )
;;
2)
- [[ ${COMP_WORDS[COMP_CWORD-1]} = @(start|stop|restart|switch-to|status|enable|disable|reenable) ]] &&
+ [[ ${COMP_WORDS[COMP_CWORD-1]} = @(start|stop|restart|switch-to|status|enable|disable|is-enabled|reenable) ]] &&
mapfile -t COMPREPLY < <(IFS=$'\n'; compgen -W "$(_netctl_profiles)" -- "$cur")
;;
esac
diff --git a/contrib/zsh-completion b/contrib/zsh-completion
index 56c552d..8e88437 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) ]] &&
+ [[ $words[1] = (start|stop|restart|switch-to|status|enable|disable|is-enabled|reenable) ]] &&
compadd "${(f)$(find -L /etc/netctl -maxdepth 1 -type f -not -name '.*' -not -name '*~' -not -name '*.conf' -not -name '*.service' -printf "%f\n")}"
}
@@ -30,6 +30,7 @@ _netctl_commands() {
'status:Show runtime status of a profile'
'enable:Enable the systemd unit for a profile'
'disable:Disable the systemd unit for a profile'
+ 'is-enabled:Check whether a profile is enabled'
'reenable:Reenable the systemd unit for a profile'
)
_describe "netctl commands" _commands
diff --git a/docs/netctl.1.txt b/docs/netctl.1.txt
index 1793041..4120bdc 100644
--- a/docs/netctl.1.txt
+++ b/docs/netctl.1.txt
@@ -68,6 +68,10 @@ The following commands are understood:
the file created by `*enable*' even if it was customized, so be
careful.
+*is-enabled [+PROFILE+]*::
+ Check whether the systemd unit for the specified profile is enabled.
+ Prints the current enable status.
+
*reenable [+PROFILE+]*::
Reenable the systemd unit for the profile specified. This is
effectively a combination of `*disable*' and `*enable*'.
diff --git a/src/netctl.in b/src/netctl.in
index dc19ab0..90be39e 100644
--- a/src/netctl.in
+++ b/src/netctl.in
@@ -9,18 +9,19 @@ Usage: netctl {COMMAND} [PROFILE]
[--help|--version]
Commands:
- list List available profiles
- store Save which profiles are active
- restore Load saved profiles
- stop-all Stops all profiles
- start [PROFILE] Start a profile
- stop [PROFILE] Stop a profile
- restart [PROFILE] Restart a profile
- switch-to [PROFILE] Switch to a profile
- status [PROFILE] Show runtime status of a profile
- enable [PROFILE] Enable the systemd unit for a profile
- disable [PROFILE] Disable the systemd unit for a profile
- reenable [PROFILE] Reenable the systemd unit for a profile
+ list List available profiles
+ store Save which profiles are active
+ restore Load saved profiles
+ stop-all Stops all profiles
+ start [PROFILE] Start a profile
+ stop [PROFILE] Stop a profile
+ restart [PROFILE] Restart a profile
+ switch-to [PROFILE] Switch to a profile
+ status [PROFILE] Show runtime status of a profile
+ enable [PROFILE] Enable the systemd unit for a profile
+ disable [PROFILE] Disable the systemd unit for a profile
+ is-enabled [PROFILE] Check whether a profile is enabled
+ reenable [PROFILE] Reenable the systemd unit for a profile
END
}
@@ -160,7 +161,7 @@ case $# in
esac;;
2)
case $1 in
- start|stop|restart|status)
+ start|stop|restart|status|is-enabled)
sd_call "$1" "$2";;
switch-to)
ensure_root "$(basename "$0")"