qovery-cli icon indicating copy to clipboard operation
qovery-cli copied to clipboard

Be able to specify the context inline on a command

Open YounessFkhach opened this issue 1 year ago • 1 comments

What would you like to be added:

Be able to specify the context inline on a command

qovery shell --context webapp:staging:web

qovery shell -c webapp:production:worker

Also, that will remove the need to have a confirmation input to validate the current context, because the user did already manually specified the context they want image

Why is this needed: For someone who manages multiple instances/environments and needs to access those envs regularly, having to go through the menu selection is slow and a bit tedious instead passing the context inline will be much faster, and will also allow to reuse shell history and auto-completion on their terminal

YounessFkhach avatar Apr 06 '23 14:04 YounessFkhach

Hello @YounessFkhach 👋🏼

Do you know that you could use the service url directly copied from the console for the shell command?

qovery shell https://console.qovery.com/organization/{organizationId}/project/{projectId}/environment/{environmentId}/application/{applicationId}

Organization | myOrg
Project      | myProject
Environment  | [PR] blueprint - my service pr - 2023-06-23T08:20:35Z
Service      | myService
ServiceType  | myApplication

@evoxmusic URL parsing is very nice but you have to go through the console. What do you think about using go prompt to perform some API request and let the user construct his context inline directly on the command? As AWS cli uses with python-prompt for cli configure sso command by example. What I think is interesting to do and can be done quickly:

  1. Creation of an inline command context option
  2. Refactor (centralisation and rationalisation) of all get context methods for all commands
  3. Remove prompt-ui method from some select context methods and put it on his own utils struct
  4. Create a go prompt utils struct for context prompt construction
  5. Create a factory method to switch to prompt-ui or go prompt

Just an idea for discussion 💡

MikeAtJulaya avatar Jun 29 '23 23:06 MikeAtJulaya