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

Confirm directory creation when using user command #599

Open
bpbecker opened this issue Sep 26, 2023 · 2 comments
Open

Confirm directory creation when using user command #599

bpbecker opened this issue Sep 26, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@bpbecker
Copy link

Currently when one enters:
]create # /some/directory/name
Link goes off and creates the directory if it doesn't exist (Link notifies you that the directory was created).

If you've mistyped/misremembered the folder name, you then need to:

  • break the link
  • delete the newly created folder

WIBNI by default Link confirmed that it should create the directory when used from a user command, using the Link API would not prompt by default. There could be a new switch or setting "confirm=1|0" or something like that so one could disable the prompt (or enable it when using the API). I think this is a sensible feature because you're almost always you're going to be Link'ing to an existing directory so if the directory doesn't exist, it's far more likely that you've mistyped the name than you actually want to create a new directory. A simple confirmation prompt 'Directory "/some/directory/name" does not exist, create it (Y/n)? ' is minimally intrusive and saves the frustration of having to clean up when you've mistyped the name.

@bpbecker bpbecker added the enhancement New feature or request label Sep 26, 2023
@abrudz
Copy link
Contributor

abrudz commented Sep 26, 2023

I like the idea, but I think it needs to be more nuanced, as there are 4 possible scenarios:

  1. Dir exists, namespace exists
  2. Dir exists, namespace missing
  3. Dir missing, namespace exists
  4. Dir missing, namespace missing
    Obviously, we don't want to ask in case 1, but in which of the others should we ask, and what exactly should we ask?

I don't think an option is necessary. It is fine for user commands always to ask, and for API functions never to ask.

@bpbecker
Copy link
Author

Yeah, I hadn't thought out all the scenarios - my posting the issue was a knee-jerk reaction to mistyping a directory name just now :).

We'd have to construct a prompt that handles cases 2-4 based on the non-existence of either the namespace, the directory, or both. It's a bit tedious, but doable...

  • 'Namespace "#.foo" does not exist, create it?'
  • 'Directory "/foo/boo" does not exist, create it?'
  • 'Namespace "#.foo" and directory "/foo/boo" do not exist, create them?'

I agree that the option isn't necessary for the user command case.

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