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

Dont ask for OVERWRITE if the filepath does not exist #428

Open
slm0n87 opened this issue Jul 26, 2024 · 3 comments
Open

Dont ask for OVERWRITE if the filepath does not exist #428

slm0n87 opened this issue Jul 26, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@slm0n87
Copy link
Member

slm0n87 commented Jul 26, 2024

Doing:

➜  ~ rm .kube/custom-contexts/inttestv128.yaml
➜  ~ ll .kube/custom-contexts/inttestv128.yaml
ls: .kube/custom-contexts/inttestv128.yaml: No such file or directory
➜  ~ s ske kubeconfig create inttestv128 --filepath ~/.kube/custom-contexts/inttestv128.yaml
Are you sure you want to create a kubeconfig for SKE cluster "inttestv128"? This will OVERWRITE your current kubeconfig file, if it exists. [y/N] y
Created kubeconfig file for cluster inttestv128 in "/Users/stier/.kube/custom-contexts/inttestv128.yaml", with expiration date 2024-07-26T08:08:00Z (UTC)
➜  ~

The cli gives a warning to overwrite the config file if it exists and have a default: No.
This is very nice, but absolut unnecessary if the file des not exist.

Expected behaviour:
Just write the file and avoid unnecessary user interaction.

@slm0n87 slm0n87 changed the title Dont ask for OVERWRITE if the file does not exist Dont ask for OVERWRITE if the filepath does not exist Jul 26, 2024
@DiogoFerrao
Copy link
Contributor

Hey @slm0n87 thank you once again for your feedback!

In commands that make changes (create, update, delete, etc), we have the common practice of asking the user for confirmation. This is also common behaviour in other CLI's and in programs in general.
However, if you don't want to be prompted for confirmation you can always provide the --assume-yes flag, which will bypass the prompts and remove the user interaction from the command.

Kind regards,
Diogo

@DiogoFerrao DiogoFerrao added the enhancement New feature or request label Jul 26, 2024
@slm0n87
Copy link
Member Author

slm0n87 commented Jul 26, 2024

Thx @DiogoFerrao, the --assume-yes helped me in that case.

I agree that its common behaviour and best practices for CLI's before overwriting existing files.
But I am not aware of any CLI where I explicitly specify a file as argument and I get prompted to confirm that I really want to save it there.

Regards,
Simon

@DiogoFerrao
Copy link
Contributor

That's a good point @slm0n87, I think this is also one of the few commands that interact with files in the user's system and not STACKIT resources that come with costs.

We could consider having a check and only prompt the user for confirmation when actually overwriting a file. We will add this topic to the our backlog and keep you updated on its progress!

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

No branches or pull requests

2 participants