-
Notifications
You must be signed in to change notification settings - Fork 6
feat: avoid auto-installing when already installed #74
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
Conversation
| /// Stores those commands that have completion installed. | ||
| /// | ||
| /// Installed commands are specific to a given [SystemShell]. | ||
| final Uninstalls installs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get we have to keep a map of all commands. If we have this lib installed on a cli, other installations should not concern this routine. In other words, this algorithm will never use more the one element in these collections, especially "installs"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this "installs" collection necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to illustrate the necessity of the installs collection with an example and the mathematical interpreation. After reading them, do you have another approach in mind?
Note that as planned off-github, installs and uninstalls are stored on a single "global" configuration file (~/.dart-cli-completion/config.json).
Example
- User uses
very_goodcommand in ZSH and it gets auto-installed, the installs collection will go from being empty to:
{
SystemShell.zsh: {"very_good"}
}- User uses
dart_frogcommand in ZSH and it gets auto-installed, the installs collection will now be:
{
SystemShell.zsh: {"very_good", "dart_frog"}
}- User uses
very_goodcommand in in Bash and it gets auto-installed, the installs collection will now be:
{
SystemShell.zsh: {"very_good", "dart_frog"},
SystemShell.bash: {"very_good"},
}- User uses
very_goodcommand in Zsh and it does not get auto-installed since we know it it already installed.
Mathematical interpretation
The

Status
READY
Description
Resolves #56
Should be merged after #73
Changes:
CompletionConfigurationUinstallstoShellCommandsMapsince it is now usedType of Change