]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
lldpcli: make complete command work on privleged commands as well
authorVincent Bernat <vincent@bernat.im>
Sat, 12 Jul 2014 11:10:47 +0000 (13:10 +0200)
committerVincent Bernat <vincent@bernat.im>
Sat, 12 Jul 2014 11:11:37 +0000 (13:11 +0200)
This avoids the use of sudo.

debian/etc/bash_completion.d/lldpcli
src/client/commands.c

index f52539e6aa268f298f0922a2b194b57b564aa4a2..8ce68d794aaf3d0b7288e20579f1ec39fdf01a86 100755 (executable)
@@ -10,7 +10,7 @@ _lldpcli()
         unset cmd[COMP_CWORD]
     fi
 
-    local choices=$(sudo ${cmd[0]} complete ${cmd[@]:1} | \
+    local choices=$(${cmd[0]} complete ${cmd[@]:1} | \
         cut -d " " -f 1)
     COMPREPLY=($(compgen -W '${choices}' -- ${cur} ))
     return 0
index 8092f8c2fa3310b8338761dfa868f62c4c8963a8..3fa48ace79a50081a68fb1c05794ed2ea12c4e1c 100644 (file)
@@ -358,7 +358,7 @@ _commands_execute(struct lldpctl_conn_t *conn, struct writer *w,
        if (completion) *word = NULL;
 
 #define CAN_EXECUTE(candidate) \
-       ((!candidate->privileged || priv) && \
+       ((!candidate->privileged || priv || complete) && \
            (!candidate->validate ||                    \
                candidate->validate(&env, candidate->arg) == 1))