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

Autocompletion of scan directories and apply available recipes #261

Merged
merged 9 commits into from
Aug 2, 2022
Merged

Autocompletion of scan directories and apply available recipes #261

merged 9 commits into from
Aug 2, 2022

Conversation

timtebeek
Copy link
Contributor

@timtebeek timtebeek commented Jul 23, 2022

Fixes #128.

Tested locally through:

  1. cd spring-boot-migrator/applications/spring-shell/
  2. mvn package -DskipTests
  3. java -jar target/spring-boot-migrator.jar
  4. scan <tab> ../../../ <tab>
  5. apply <tab> <tab>

That should provide you with auto complete examples located next to spring-boot-migrator.
Followed by autocompletion of available recipes.

@timtebeek
Copy link
Contributor Author

Needs a slash ../ before you're able to navigate directories; I think that's fair enough though, and not worth changing.

@timtebeek timtebeek changed the title Scan autocompletion of directories Autocompletion of scan directories and apply available recipes Jul 23, 2022
public List<CompletionProposal> complete(CompletionContext completionContext) {
ProjectContext projectContext = projectContextHolder.getProjectContext();
List<Recipe> applicableRecipes = applicableRecipeListCommand.execute(projectContext);
return applicableRecipes.stream().map(Recipe::getName).map(CompletionProposal::new).toList();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Figured this one is so simple and duplicates parts of ApplyShellCommand.apply, that it does not warrant it's own unit test.

@fabapp2
Copy link
Collaborator

fabapp2 commented Aug 2, 2022

Hi @timtebeek,
first of all, thank you for your contribution!
Sorry for my late reply, I've been on PTO.

I like the auto-completion. For path auto-completion, I think we could improve the handling a bit to make it easier to use.
I created a new issue and merge this PR.

@fabapp2 fabapp2 merged commit a89dcfd into spring-projects-experimental:main Aug 2, 2022
@timtebeek timtebeek deleted the scan-autocompletion branch August 2, 2022 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Autocomplete both applications to scan, and recipes to apply
2 participants