Support --sudo #480

Open
opened 2022-03-31 16:27:53 +00:00 by 6543 · 4 comments
Owner

add flag for admins to exec things for other users

add flag for admins to exec things for other users
6543 added the
kind
feature
label 2022-03-31 16:27:53 +00:00
Member

There's two ways to go about this:

  1. add this flag to most subcommands. example:
    tea pr merge --sudo=6543 480

  2. have a new subcommand tea sudo, that inherits most other tea commands as subcommands and adds the --sudo flag like this:
    tea sudo --sudo=6543 pr merge 480.

Option (1) has slightly higher maintenance effort, as the flag needs to be manually added to all (new) subcommands.
Option (2) is low effort to implement (see noerw/tea:sudo branch), but because urfave/cli has strict argument/flag ordering, is a bit fiddly to use (--sudo must go before the subcommand).

There's two ways to go about this: 1. add this flag to most subcommands. example: `tea pr merge --sudo=6543 480` 2. have a new subcommand `tea sudo`, that inherits most other tea commands as subcommands and adds the `--sudo` flag like this: `tea sudo --sudo=6543 pr merge 480`. Option (1) has slightly higher maintenance effort, as the flag needs to be manually added to all (new) subcommands. Option (2) is low effort to implement (see [noerw/tea:sudo branch](https://gitea.com/gitea/tea/compare/main...noerw/tea:sudo)), but because urfave/cli has strict argument/flag ordering, is a bit fiddly to use (--sudo must go before the subcommand).
Author
Owner

go with 2 ... "les maintinance cost" did catched me ;)

go with 2 ... "les maintinance cost" did catched me ;)
Owner

I like 1 because it will not introduce a new command. For users, it's easy to remember.

I like 1 because it will not introduce a new command. For users, it's easy to remember.
Author
Owner

cli v3 does sollfe the mentioned issue ... so we can have global flags that will be able to be added at the end

cli v3 does sollfe the mentioned issue ... so we can have global flags that will be able to be added at the end
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
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: gitea/tea#480
No description provided.