From aabe449f5979f5093aaeb0d253c2e84ea1613854 Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Sat, 30 Mar 2024 09:52:18 +0300 Subject: [PATCH] Network : Add ns, nu and nd. --- module/common/bash/module/Network.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/module/common/bash/module/Network.sh b/module/common/bash/module/Network.sh index be49f9e..08e63d5 100644 --- a/module/common/bash/module/Network.sh +++ b/module/common/bash/module/Network.sh @@ -7,3 +7,26 @@ function bluetooth() { function network() { nm-connection-editor } + +# Show active connections. +function ns() { + nmcli connection show +} + +# Start the connection. +# Usage: nu +function nu() { + nmcli connection up "${@}" +} + +# Stop the connection. +# Usage: nd +function nd() { + nmcli connection down "${@}" +} + +function _complete_connections() { + _autocomplete $(nmcli connection show | sed "1d" | cut -d\ -f1) +} + +complete -F _complete_connections nd nu