[GH-ISSUE #62] Two hyphen to much on autocompletion #16

Closed
opened 2026-05-07 00:17:29 +02:00 by BreizhHardware · 3 comments

Originally created by @dwydler on GitHub (Nov 22, 2020).
Original GitHub issue: https://github.com/ovh/the-bastion/issues/62

Hello,
i typed adminSudo and press that two times the key. The first parameter is displayed with four hyphen.

---bs-server----------------------------------------------the-bastion-3.01.00---
----------------------------------------------------------------------</help>---
administrator@bastionhost01(master)> adminSudo -- --sudo-as
Originally created by @dwydler on GitHub (Nov 22, 2020). Original GitHub issue: https://github.com/ovh/the-bastion/issues/62 Hello, i typed adminSudo and press that two times the <TAB> key. The first parameter is displayed with four hyphen. ``` ---bs-server----------------------------------------------the-bastion-3.01.00--- ----------------------------------------------------------------------</help>--- administrator@bastionhost01(master)> adminSudo -- --sudo-as ```
Author
Owner

@speed47 commented on GitHub (Nov 23, 2020):

adminSudo is a bit special, the first double-dash is corrrect, as explained in the adminSudo --help message:

~ Impersonate another user
~ 
~ Usage: --osh adminSudo -- --sudo-as ACCOUNT <--sudo-cmd PLUGIN -- [PLUGIN specific options...]>
~ 
~   --sudo-as ACCOUNT  Specify which bastion account we want to impersonate
~   --sudo-cmd PLUGIN  --osh command we want to launch as the user (see --osh help)
~ 
~ Example::
~ 
~   --osh adminSudo -- --sudo-as user12 --sudo-cmd info -- --name somebodyelse
~ 
~ Don't forget the double-double-dash as seen in the example above: one after the plugin name,
~ and another one to separate adminSudo options from the options of the plugin to be called.

This is to ensure the proper options are parsed by the proper stage of execution, because under the hood, you're sudo'ing to the target user, and executing osh.pl again under their name

<!-- gh-comment-id:732004897 --> @speed47 commented on GitHub (Nov 23, 2020): `adminSudo` is a bit special, the first double-dash is corrrect, as explained in the `adminSudo --help` message: ``` ~ Impersonate another user ~ ~ Usage: --osh adminSudo -- --sudo-as ACCOUNT <--sudo-cmd PLUGIN -- [PLUGIN specific options...]> ~ ~ --sudo-as ACCOUNT Specify which bastion account we want to impersonate ~ --sudo-cmd PLUGIN --osh command we want to launch as the user (see --osh help) ~ ~ Example:: ~ ~ --osh adminSudo -- --sudo-as user12 --sudo-cmd info -- --name somebodyelse ~ ~ Don't forget the double-double-dash as seen in the example above: one after the plugin name, ~ and another one to separate adminSudo options from the options of the plugin to be called. ``` This is to ensure the proper options are parsed by the proper stage of execution, because under the hood, you're `sudo`'ing to the target user, and executing `osh.pl` again under their name
Author
Owner

@speed47 commented on GitHub (Nov 23, 2020):

Took the opportunity to add some smartness to adminSudo's autocompletion rules!

<!-- gh-comment-id:732028056 --> @speed47 commented on GitHub (Nov 23, 2020): Took the opportunity to add some smartness to adminSudo's autocompletion rules!
Author
Owner

@dwydler commented on GitHub (Nov 23, 2020):

Thanks a lot for the clarification.

<!-- gh-comment-id:732075682 --> @dwydler commented on GitHub (Nov 23, 2020): Thanks a lot for the clarification.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/the-bastion#16
No description provided.