Skip to content

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

Description

@slm0n87

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.

Activity

  1. changed the title [-]Dont ask for OVERWRITE if the file does not exist[/-] [+]Dont ask for OVERWRITE if the filepath does not exist[/+] on Jul 26, 2024
  2. DiogoFerrao commented on Jul 26, 2024

    @DiogoFerrao
    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

  3. slm0n87 commented on Jul 26, 2024

    @slm0n87
    MemberAuthor

    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

  4. DiogoFerrao commented on Jul 26, 2024

    @DiogoFerrao
    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions