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

fix: The package touches files and directories in $HOME without asking #64

Closed
bartekpacia opened this issue Apr 25, 2023 · 6 comments
Closed
Labels
bug Something isn't working as expected p3 Issues that we currently consider unimportant

Comments

@bartekpacia
Copy link

bartekpacia commented Apr 25, 2023

Description

When my CLI program (that is using package:cli_completion) is run for the first time, it:

  • appends some initialization logic to ~/.zshrc (in my case - I'm using Zsh)

    $ tail -n 5 ~/.zshrc                                                                                      
    ## [Completion]
    ## Completion scripts setup. Remove the following line to uninstall
    [[ -f /Users/bartek/.config/.dart-cli-completion/zsh-config.zsh ]] && . /Users/bartek/.config/.dart-cli-completion/zsh-config.zsh || true
    ## [/Completion]
  • creates the ~/.dart-cli-completion directory, which apparently stores the completion files for every program using it:

    $ ls ~/.dart-cli-completion/
    patrol.zsh     zsh-config.zs

Steps To Reproduce

Add this package to a CLI program (as per the README) and run it.

Expected Behavior

I don't want my CLI program to touch my user's $HOME. It's not nice.

I also feel like this behavior should be clearly stated in the readme.

Additional Context

Initially reported in this issue.

@bartekpacia bartekpacia added the bug Something isn't working as expected label Apr 25, 2023
@bartekpacia bartekpacia changed the title fix: fix: The package touches files and directories in $HOME without asking Apr 25, 2023
@renancaraujo
Copy link
Contributor

Hell there,

As the docs say, to disable auto install, set 'enableAutoInstall' to false on your CompletionCommandRunner subclass.

The workings of the package are stated in the docs:

https://github.com/VeryGoodOpenSource/cli_completion/tree/main/doc

@bartekpacia
Copy link
Author

Thanks for the quick answer.

I have no experience with shell completions, but could an alternative approach be developed? Some software automatically installs its own completions when brew installed.

Though I suspect that it'd be more complicated to set up than it currently is.

@renancaraujo
Copy link
Contributor

There are other ways, for example, fig. But that requires the completion schema to be published within its registry, with is not too ergonomic.
Another alternative is to add completions in runtime via oh my zsh plugin system.

Any of these alternatives rule out the possibility of mapping the suggestions from the ArgParser objects, which is the whole point of this package.

For this issue, we can:

  • Disable auto-install by default, or
  • Remove auto-install altogether and force final users to install scripts "manually"

@bartekpacia
Copy link
Author

bartekpacia commented Apr 25, 2023

Disable auto-install by default

I wouldn't do it. I might not like scripts modifying my ~/.zshrc but I'm sure a whole lot more people don't bother with it, but they do want to have completions.

Remove auto-install altogether and force final users to install scripts "manually"

Could there be 2 ways of installing the completions? The current one - automatic, and the new one - manual - that'd require the user to move the generated completions file into some place where all completion files live.

@renancaraujo
Copy link
Contributor

renancaraujo commented May 11, 2023

Could there be 2 ways of installing the completions? The current one - automatic, and the new one - manual - that'd require the user to move the generated completions file into some place where all completion files live.

Something close to that would be #58, that imitates how npm and flutter (yes, flutter completion is a command)

@tomarra tomarra added the p3 Issues that we currently consider unimportant label Feb 21, 2024
@bartekpacia
Copy link
Author

I am going to close this issue since my question has been answered here. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected p3 Issues that we currently consider unimportant
Projects
Development

No branches or pull requests

3 participants