Skip to content

Smart completion #1392

@hohwille

Description

@hohwille

Feature idea

IDEasy has build in auto-compeltion working in bash and zsh what is great.
However, it would be awesome if the completion was more smart and even complete arguments of supported tools.

Additional context

ide mv[Tab]

will complete to

ide mvn 

what is perfect.
But

ide mvn clea[Tab]

does not complete anything.
However, it could/should complete to

ide mvn clean

For maven the following keywords should be completed:

  • clean
  • package
  • install
  • deploy
  • test
  • verify
  • validate
  • compile
  • dependency:tree
  • dependency:list
  • help:effective-settings
  • -DskipTests
  • exec:java
  • -Dexec.mainClass=
  • -Dexec.args=
  • --also-make
  • --also-make-dependents
  • --fail-at-end
  • --fail-fast
  • -T1C
  • -DdeployAtEnd=true
  • ...

Surely some tools will change and evolve their CLI over time so this may not be the best approach for every tool since the completion can dependent on the version of the tool.
To get a perfect solution, we would need to delegate the completion to the according tool.
However, starting with maven looks promising since it does not support completion from the tool itself.
Only as external solution that also cannot handle all different versions, but the maven CLI is quite stable.
See https://github.com/juven/maven-bash-completion

So my suggestion would be to start with a PR that adds at least the above suggested completions for maven.
To reuse this later for other LocalToolCommandlets we should provide generic support in that class so Mvn sub-class only needs to extend or override something to e.g. provide the above keywords as String array.
For advanced use-cases later we can still add more complexity and consider that -Dexec.mainClass only makes sense in combination with exec:java.
Also be aware that those "keywords" above that end with = are not complete so they should not add a whitespace after its completion since the user needs to type things after like -Dexec.mainClass=com.devonfw.tools.ide.cli.Ideasy.

Metadata

Metadata

Assignees

Labels

Projects

Status

🏗 In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions