Skip to content

#2134: Add auto-completion for icd command#2207

Open
Ali-Shariati-Najafabadi wants to merge 4 commits into
devonfw:mainfrom
Ali-Shariati-Najafabadi:feature/2134-Add-icd-autocompletion
Open

#2134: Add auto-completion for icd command#2207
Ali-Shariati-Najafabadi wants to merge 4 commits into
devonfw:mainfrom
Ali-Shariati-Najafabadi:feature/2134-Add-icd-autocompletion

Conversation

@Ali-Shariati-Najafabadi

@Ali-Shariati-Najafabadi Ali-Shariati-Najafabadi commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

This PR fixes #2134

Implemented changes:

  • Added bash tab-completion for the icd command:
    • icd -p [Tab] suggests available IDEasy projects (directories under IDE_ROOT containing settings and workspaces)
    • icd -p <project> -w [Tab] suggests the workspaces of that project (or of the current/inferred project if -p was omitted)
    • icd -p <project> -r [Tab] (optionally with -w <workspace>) suggests the repositories found inside the relevant workspace(s)
  • Implemented in bash (cli/src/main/package/functions)
  • Documented the new completion behavior in documentation/cli.adoc
  • Added integration test cli/src/test/integration-tests/icd-completion.sh that simulates COMP_WORDS/COMP_CWORD and asserts COMPREPLY for all three completion cases plus the fallback flag list

Testing instructions

  1. Source cli/src/main/package/functions in a bash shell with IDE_ROOT set to a directory containing at least one IDEasy project (with settings and workspaces subfolders)
  2. Type icd -p and press [Tab] → available projects are listed
  3. Type icd -p <project> -w and press [Tab] → workspaces of that project are listed
  4. Type icd -p <project> -r and press [Tab] → repositories inside the project's workspace(s) are listed
  5. Run cli/src/test/all-tests.sh (or just the new icd-completion.sh integration test) to verify automated coverage

Checklist for this PR

  • When running mvn clean test locally all tests pass and build is successful
  • PR title is of the form #«issue-id»: «brief summary»
  • PR top-level comment summarizes what has been done and contains link to addressed issue(s)
  • PR and issue(s) have suitable labels
  • Issue is set to In Progress and assigned to you
  • You followed all coding conventions
  • You have added the issue implemented by your PR in CHANGELOG.adoc unless issue is labeled with internal
  • You have formulated clear instructions on how to test your contribution under "Testing instructions"

@github-project-automation github-project-automation Bot moved this to 🆕 New in IDEasy board Jul 23, 2026
@Ali-Shariati-Najafabadi Ali-Shariati-Najafabadi added enhancement New feature or request icd Changes related to our icd command. labels Jul 23, 2026
@coveralls

coveralls commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 30081059314

Coverage increased (+0.03%) to 72.594%

Details

  • Coverage increased (+0.03%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 16958
Covered Lines: 12832
Line Coverage: 75.67%
Relevant Branches: 7584
Covered Branches: 4984
Branch Coverage: 65.72%
Branches in Coverage %: Yes
Coverage Strength: 3.2 hits per line

💛 - Coveralls

@Ali-Shariati-Najafabadi Ali-Shariati-Najafabadi moved this from 🆕 New to 🏗 In progress in IDEasy board Jul 23, 2026
@Caylipp Caylipp self-assigned this Jul 23, 2026
@Ali-Shariati-Najafabadi Ali-Shariati-Najafabadi moved this from 🏗 In progress to Team Review in IDEasy board Jul 23, 2026
@Caylipp

Caylipp commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

I manually verified the completion behavior:

  • icd -p [Tab] suggests the available projects and correctly filters by prefix.
  • icd -p IDEasy -w [Tab] suggests the expected workspaces (ide-urls and main).
  • Flag completion also works as expected.

However, the automated test suite is currently failing:

  • help.sh exits with code 1.
  • The newly added icd-completion.sh exits with code 1.
Running test #2: icd-completion.sh
Running icd completion integration test
icd-completion.sh: line 14: _icd_completion: command not found
RESULTS:
[ERROR] Failed running test #2: icd-completion.sh - exit code 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request icd Changes related to our icd command.

Projects

Status: Team Review

Development

Successfully merging this pull request may close these issues.

Add auto-completion for icd command (projects, workspaces, and repositories)

3 participants