Skip to content

feat: unified autocomplete entrypoint #58

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

molisani
Copy link
Member

@molisani molisani commented Feb 26, 2025

Describe your changes
The core exposes a function proposeCompletions that is responsible for generating a set of completions for the given app + inputs. However, there needs to be some "glue" to adapt that function for each shell. At the moment, the only shell that's supported is bash (but that is going to change). Currently the "glue" is written into the new application template, which makes it virtually impossible to change and it is only implementing the bash "glue".

This PR adds a new handleCompletionsForShell function to @stricli/auto-complete that accepts the same args as proposeCompletions AND the kind of shell. It then handles the "glue" for that specific shell kind and resolves async. This will allow for changes to this logic to be handled "internally" to these packages, and doesn't require any application-owner changes to support a new shell (once it is supported by @stricli/auto-complete). To this end, there are new install-all and uninstall-all commands that will attempt to install/uninstall the autocomplete functionality for every supported shell all at once.

Testing performed
Unit tests exercise the new behavior of @stricli/auto-complete for bash that handles editing the .bashrc and generating the completions (making sure the inputs and outputs are correct). There are also changes to the @stricli/create-app baselines to account for the changes in autocomplete handling.

These changes were also confirmed manually by generating a new application with @stricli/create-app and verifying the behavior in a bash shell.

@molisani molisani self-assigned this Feb 26, 2025
@github-actions github-actions bot added auto-complete 🔮 Relates to the @stricli/auto-complete package create-app 📂 Relates to the @stricli/create-app package labels Feb 26, 2025
@molisani molisani force-pushed the feat/unified-autocomplete-handling branch 4 times, most recently from 4aa35fe to 963e55e Compare February 27, 2025 15:11
@molisani molisani marked this pull request as ready for review February 27, 2025 15:18
@molisani molisani requested a review from a team as a code owner February 27, 2025 15:18
@molisani molisani force-pushed the feat/unified-autocomplete-handling branch from 963e55e to 5d12878 Compare March 25, 2025 13:46
molisani and others added 2 commits March 25, 2025 09:58
Signed-off-by: Michael Molisani <[email protected]>
Signed-off-by: Michael Molisani <[email protected]>
@molisani molisani force-pushed the feat/unified-autocomplete-handling branch from 5d12878 to e01b8ce Compare March 25, 2025 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-complete 🔮 Relates to the @stricli/auto-complete package create-app 📂 Relates to the @stricli/create-app package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant