Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMPROVE] Add --remove parameter to the Terminal /keys menu. #5712

Open
deeleeramone opened this issue Nov 11, 2023 · 4 comments
Open

[IMPROVE] Add --remove parameter to the Terminal /keys menu. #5712

deeleeramone opened this issue Nov 11, 2023 · 4 comments
Labels
enhancement Enhancement

Comments

@deeleeramone
Copy link
Contributor

Currently there is no way to completely remove an entered API key within the Terminal. Currently, it can be done online or manually editing the ENV file, but this is not the ideal UX.

@deeleeramone deeleeramone added the enhancement Enhancement label Nov 11, 2023
@ayrt-n
Copy link
Contributor

ayrt-n commented Dec 30, 2023

I'd be happy to try and tackle this if this is still an issue. Would we want the command to alter the users hub config? Or just the local ENV file?

@deeleeramone
Copy link
Contributor Author

I'd be happy to try and tackle this if this is still an issue. Would we want the command to alter the users hub config? Or just the local ENV file?

Currently, the ENV file takes priority over any Hub keys, so I believe these would operate independently. The account menu has a clear function which clears all keys from Hub, so maybe this one needs parameters for clearing an individual source. Any thoughts or opinions on this, @montezdesousa?

@ayrt-n
Copy link
Contributor

ayrt-n commented Jan 6, 2024

Working on the keys controller right now. For APIs with a single key, it's pretty straight forward to just add a new argument --remove. We are able to enforce the user to use --key or --remove and not both using mutually exclusive groups. However, with APIs which need a number of arguments to add an API (e.g., reddit), it's a bit more clunky (and requires us to code in the checks ourselves).

Are we okay with adding sub-commands / subparsers? For example, to add or remove a key now the user could type any of the following (api name, followed by add or remove sub-command, and then arguments):

$ fred add -k 1234
$ fred add 1234
$ fred remove

$ reddit add -i 123 -s 4 -u 5 -p 6 -a 7
$ reddit remove

This has the benefit of separating the add/remove options and after trying a number of things, this seemed like the cleanest implementation to me. Alternatively if we don't like this, what do we want to happen if the user enters a key value and remove, e.g.:

$ reddit --identity 1234 --remove

I can provide some code snippets of how both of these implementations would look if curious.

@ayrt-n
Copy link
Contributor

ayrt-n commented Jan 17, 2024

@deeleeramone any thoughts on the above question re: subcommands? I have pretty much got a completed PR. Perhaps I could just submit for discussion, school is going to start picking up for me and would hate for it to die on my local branch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement
Projects
None yet
Development

No branches or pull requests

2 participants