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

Add icd command #778

Closed
hohwille opened this issue Nov 20, 2024 · 0 comments · Fixed by #811
Closed

Add icd command #778

hohwille opened this issue Nov 20, 2024 · 0 comments · Fixed by #811
Assignees
Labels
bash CLI IDEasy command-line-interface (parsing args, etc.) enhancement New feature or request

Comments

@hohwille
Copy link
Member

hohwille commented Nov 20, 2024

As a IDEasy power user, I want to have advanced support for switching directories, projects and environments so that I gain efficiency during development.

The idea is to introduce a new command icd additionally to ide.
This will be an IDEasy variant of the standard cd command but with the following features:

  • whenever I changed a directory with icd, I do not have to type ide again to update my environment variables.
  • when I call icd without arguments, I will go to $IDE_HOME (instead of $HOME when calling cd). In case I am not in an IDEasy project (and have not set IDE_HOME), I will go to $IDE_ROOT.
  • when I call icd -p «project» I directly jump to that project (cd $IDE_ROOT/«project» && ide)
  • when I call icd -w [«workspace»] I directly go to the specified «workspace». The default is main if omitted. If I am not in an IDE project, this command will fail.
  • when I call `icd

Advanced features (might come in a later PR):

  • when I call icd -m [«module»] I directly go to the specified «module» in my current project. That means if I am in a maven, gradle, npm, or yarn project, I directly go to the specified module. If I omit the module name I go to the current module I am in so if I am in «module»/src/main/java/com/devonfw/tools/ide I go to «module» (cd ../../../../../../.. && ide). When I call icd -m / I go to the top-level module (project root). This feature will be rather tricky - to support multiple build systems we need some flexibility. For «module» we should always support artifactId in case of a maven/gradle project but also the module directory name if unique. In order to get the entire list of modules (Map from artifactId as String to Path) quite some parsing might be required so maybe we need caching to better support this feature efficiently. The basic approach is to traverse directories upwards until the first pom.xml, build.gradle[.kts], or package.json is found. This way icd -m and icd -m / can be implemented without parsing any of these files.
  • I want to have autocompletion for icd so icd -p TAB will suggest me all available projects (and not _ide).

ATTENTION: IMHO it makes sense to first implement #779 before starting with this story since the refactoring will make it easier to add icd and otherwise both stories might cause conflicts if developed in parallel.

Implementation hint: I would suggest to implement icd in BASH.
Please note that no sophisticated CLI parser needs to be implemented in BASH: You cannot combine any of the options like -p, -w, -m, etc. Also you cannot enter directories called -p with icd and there is no need to support -- since you can use regular cd command for such crazy edge-cases.

@hohwille hohwille added enhancement New feature or request bash CLI IDEasy command-line-interface (parsing args, etc.) labels Nov 20, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in IDEasy board Nov 20, 2024
@hohwille hohwille self-assigned this Nov 25, 2024
hohwille added a commit to hohwille/IDEasy that referenced this issue Nov 26, 2024
@hohwille hohwille moved this from 🆕 New to 🏗 In progress in IDEasy board Nov 26, 2024
@hohwille hohwille added this to the release:2024.12.001 milestone Nov 26, 2024
hohwille added a commit that referenced this issue Nov 28, 2024
…rent shell #782: fix IDE_ROOT on linux/mac #774: fixed HTTP proxy support (#811)
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in IDEasy board Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bash CLI IDEasy command-line-interface (parsing args, etc.) enhancement New feature or request
Projects
Status: ✅ Done
1 participant