GNOME Bugzilla – Bug 768737
[review] lr/completion-2: Improve --complete-args
Last modified: 2016-08-01 14:14:35 UTC
This extends coverage of the --complete-args functionality. Notably missing: * -f option * actual nmcli-completion conversion to use --complete-args https://cgit.freedesktop.org/NetworkManager/NetworkManager/log/?h=lr/completion-2
> cli/device: add Wi-Fi access point completion functionality +static void +complete_aps (NMDevice **devices, const char *ifname, + const char *bssid_prefix, const char *ssid_prefix) The function is not used at this point and thus this commit doesn't compile with -Werror; please move it to the later commit that uses it. > cli/device: add completion to wifi rescan subcommand do_device_wifi_rescan (NmCli *nmc, int argc, char **argv) ... ifname = *argv; + complete_device (devices, ifname, TRUE); The completion here is done even if !nmc->complete. > cli/device: add completion to wifi list subcommand > cli/device: add completion to wifi connect subcommand > cli/device: add completion to wifi hotspot subcommand The same here. > cli/connections: do connection completion in get_connection() static NMConnection * get_connection (NmCli *nmc, int *argc, char ***argv, int *pos, GError **error) { ... + if (*argc == 1) + nmc_complete_strings (**argv, "id", "uuid", "path", NULL); We should also check nmc->complete, otherwise: $ nmcli connection up i id Error: unknown connection 'i'.
Thanks. Updated the branch to address all the issues.
LGTM (pushed a couple of fixups).
LGTM one silly, minor-minor thing: in nmcli.h we have 4 enum types. All but one didn't had the comma after the final element. Now this branch makes that number even... maybe you want to add the comma to the final element to all: --- a/clients/cli/nmcli.h +++ b/clients/cli/nmcli.h @@ -78,7 +78,7 @@ typedef enum { NMC_TERM_COLOR_BLUE = 5, NMC_TERM_COLOR_MAGENTA = 6, NMC_TERM_COLOR_CYAN = 7, - NMC_TERM_COLOR_WHITE = 8 + NMC_TERM_COLOR_WHITE = 8, } NmcTermColor; typedef enum { @@ -94,7 +94,7 @@ typedef enum { typedef enum { NMC_PRINT_TERSE = 0, NMC_PRINT_NORMAL = 1, - NMC_PRINT_PRETTY = 2 + NMC_PRINT_PRETTY = 2, } NMCPrintOutput;
(In reply to Francesco Giudici from comment #4) > LGTM > > one silly, minor-minor thing: in nmcli.h we have 4 enum types. All but one > didn't had the comma after the final element. Now this branch makes that > number even... maybe you want to add the comma to the final element to all: > > --- a/clients/cli/nmcli.h > +++ b/clients/cli/nmcli.h > @@ -78,7 +78,7 @@ typedef enum { > NMC_TERM_COLOR_BLUE = 5, > NMC_TERM_COLOR_MAGENTA = 6, > NMC_TERM_COLOR_CYAN = 7, > - NMC_TERM_COLOR_WHITE = 8 > + NMC_TERM_COLOR_WHITE = 8, > } NmcTermColor; > > typedef enum { > @@ -94,7 +94,7 @@ typedef enum { > typedef enum { > NMC_PRINT_TERSE = 0, > NMC_PRINT_NORMAL = 1, > - NMC_PRINT_PRETTY = 2 > + NMC_PRINT_PRETTY = 2, > } NMCPrintOutput; I'm leaving it as it is. It most places we leave the comma in place, but I haven't touched those who don't and would prefer not to touch unrelated lines. Merged