RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1351263 - [review] lr/cli-ask-rh1351263: [RFE] allow passing -a to the end of nmcli command
Summary: [review] lr/cli-ask-rh1351263: [RFE] allow passing -a to the end of nmcli com...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: NetworkManager
Version: 7.3
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Lubomir Rintel
QA Contact: Desktop QE
URL:
Whiteboard:
Depends On:
Blocks: 1393481
TreeView+ depends on / blocked
 
Reported: 2016-06-29 14:44 UTC by Vladimir Benes
Modified: 2017-08-01 09:17 UTC (History)
10 users (show)

Fixed In Version: NetworkManager-1.8.0-0.4.rc1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 09:17:07 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2017:2299 0 normal SHIPPED_LIVE Moderate: NetworkManager and libnl3 security, bug fix and enhancement update 2017-08-01 12:40:28 UTC

Description Vladimir Benes 2016-06-29 14:44:17 UTC
Description of problem:
as stated here: https://bugzilla.redhat.com/show_bug.cgi?id=1141947#add_comment
it would be nice to allow --ask parameter (and maybe others) to be entered at the end as if you don't have some credentials you have to go all the way back to add -a.

Version-Release number of selected component (if applicable):
1.2

Comment 1 Thomas Haller 2016-07-05 14:34:19 UTC
note that for convenience, nmcli supports all kind of abbreviations for options and arguments. Allowing options in every order makes parsing more complicated (maybe) and possibly more ambiguous.

But sounds like a good thing to me.


For now, assigning to Lubomir as he did the recent nmcli rework :)

Comment 2 Blueowl 2016-12-06 09:56:11 UTC
Although accepting options (--ask here) at the end might seem handy first, it would be at the cost of unnecessary complexity and ambiguity. And I think KISS principle should be kept here.

--ask can be added with command-line (bash) editing shortcuts very simply :)
Just pressing two shortcuts:

Home Alt-F
or
Ctrl-A Alt-F

and then adding "-a" option.

A few useful links:
* http://www.howtogeek.com/howto/ubuntu/keyboard-shortcuts-for-bash-command-shell-for-ubuntu-debian-suse-redhat-linux-etc/
* http://www.skorks.com/2009/09/bash-shortcuts-for-maximum-productivity/
* https://wiki.archlinux.org/index.php/Keyboard_shortcuts
* http://superuser.com/questions/344308/bash-jump-to-first-argument

Comment 3 Lubomir Rintel 2017-03-24 14:02:34 UTC
I believe it makes sense to process --ask anywhere. It also simplifies things a bit, since the concept of a global option concept removes the need for special casing of --show-secrets option.

https://cgit.freedesktop.org/NetworkManager/NetworkManager/log/?h=lr/cli-ask-rh1351263

Comment 4 Francesco Giudici 2017-03-25 11:26:01 UTC
In process_command_line() there is now a redundant completion for --ask --show-secret: pushed a fixup on top of the branch for that.

top commit msg:
cli/connections: drop the redundant parsinG of --show-secrets
(G is missing)



Now the --ask and --show-secrets options are auto-completed everywhere.
A couple of examples:
1) "nmcli" auto-completes main commands and just "--ask" and "--show-secrets" options only (before options were just suggested if "-" was found)
2) "nmcli conn show" auto-completes "--ask". Uglier, when autocompleted in "nmcli conn show uuid".

Not sure is good having --ask and --show-secrets auto-completing everywhere.
I think it is fine to have them enabled at any point in the command, but would be better to have more control on where they pop out in auto-completion.

rest lgtm

Comment 5 Lubomir Rintel 2017-03-27 13:17:51 UTC
(In reply to Francesco Giudici from comment #4)
> In process_command_line() there is now a redundant completion for --ask
> --show-secret: pushed a fixup on top of the branch for that.
> 
> top commit msg:
> cli/connections: drop the redundant parsinG of --show-secrets
> (G is missing)

Fixed.

> Now the --ask and --show-secrets options are auto-completed everywhere.
> A couple of examples:
> 1) "nmcli" auto-completes main commands and just "--ask" and
> "--show-secrets" options only (before options were just suggested if "-" was
> found)
> 2) "nmcli conn show" auto-completes "--ask". Uglier, when autocompleted in
> "nmcli conn show uuid".
> 
> Not sure is good having --ask and --show-secrets auto-completing everywhere.
> I think it is fine to have them enabled at any point in the command, but
> would be better to have more control on where they pop out in
> auto-completion.

Good catch. I restored the behaviour where it completes when "-" is already seen. I think that in that case it makes sense to restore it in all cases where it's actually allowed.

> rest lgtm

Fixed up the first commit not to parse the global options when a value is expected. (e.g. so that nmcli c add con-name --ask would not change behavior)

Pushed an updated branch

Comment 6 Francesco Giudici 2017-03-28 07:32:39 UTC
lgtm

Comment 7 Beniamino Galvani 2017-03-28 12:03:20 UTC
Minor issue:

 nmcli connection show wired --show-secrets

does not show secrets. Otherwise looks good.

Comment 8 Lubomir Rintel 2017-03-28 13:59:36 UTC
(In reply to Beniamino Galvani from comment #7)
> Minor issue:
> 
>  nmcli connection show wired --show-secrets
> 
> does not show secrets. Otherwise looks good.

Yes, that is because the option is only read after the connection is processed. Will try to improve this in future.

Merged as-is in fa292a60aa180101ff7192f5c0dd52231ea37356

Comment 10 errata-xmlrpc 2017-08-01 09:17:07 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:2299


Note You need to log in before you can comment on or make changes to this bug.