]> git.ipfire.org Git - people/ms/network.git/commitdiff
ipsec-connection: add description feature
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Wed, 16 Aug 2017 09:46:58 +0000 (11:46 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 16 Aug 2017 12:32:33 +0000 (14:32 +0200)
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/bash-completion/network
src/functions/functions.description
src/functions/functions.ipsec

index 807f0039b054d59a05d0d9eb797f2b47a4651a22..71bf24520b1379b79fe7719698e83d33819a62c7 100644 (file)
@@ -413,7 +413,7 @@ _network_vpn_ipsec_connection_subcommands() {
        shift
        local words=( $@ )
 
-       local commands="authentication color down inactivity-timeout local mode peer remote security-policy show up"
+       local commands="authentication color description down inactivity-timeout local mode peer remote security-policy show up"
        local cmd="$(_network_find_on_cmdline "${commands}")"
        if [[ -z "${cmd}" ]]; then
                COMPREPLY=( $(compgen -W "${commands}" -- "${cur}") )
@@ -429,6 +429,9 @@ _network_vpn_ipsec_connection_subcommands() {
                color)
                        _network_color ${args}
                        ;;
+               description)
+                       _network_description ${args}
+                       ;;
                local)
                        _network_vpn_ipsec_connection_subcommands_local_remote ${connection} "local" ${args}
                        ;;
index 0db8ede8a74a75fb6d4e6664bf75049f754f5313..728ec2cac10d060133ec59522ed956ad8c00c4f9 100644 (file)
@@ -25,6 +25,9 @@ description_format_filename() {
        local name=${2}
 
        case ${type} in
+               ipsec-connection)
+                       echo "${NETWORK_IPSEC_CONNS_DIR}/${name}/description"
+                       ;;
                zone)
                        echo "$(zone_dir ${name})/description"
                        ;;
index 73c7e8739a1cd57622255288109a521625676f12..6c2a0df83e154ff4c255778b8b56e43324bb6ad2 100644 (file)
@@ -86,6 +86,9 @@ cli_ipsec_connection() {
                        color)
                                color_cli "ipsec-connection" "${connection}" "$@"
                                ;;
+                       description)
+                               description_cli "ipsec-connection" ${connection} $@
+                               ;;
                        show)
                                cli_ipsec_connection_show "${connection}"
                                exit $?
@@ -138,6 +141,13 @@ ipsec_connection_get_color() {
        color_read "ipsec-connection" ${name}
 }
 
+ipsec_connection_get_description_title() {
+       assert [ $# -eq 1 ]
+
+       local name=${1}
+       description_title_read $(description_format_filename "ipsec-connection" "${name}")
+}
+
 cli_ipsec_connection_show() {
        local connection="${1}"
 
@@ -152,6 +162,7 @@ cli_ipsec_connection_show() {
        cli_space
 
        cli_print_fmt1 1 "Color" "$(cli_color_bar $(ipsec_connection_get_color ${connection}))"
+       cli_print_fmt1 1 "Description" "$(ipsec_connection_get_description_title ${connection})"
        cli_space
 
        # Peer