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

Consider functions instead of alias #779

Closed
hohwille opened this issue Nov 20, 2024 · 1 comment · Fixed by #811
Closed

Consider functions instead of alias #779

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

Comments

@hohwille
Copy link
Member

In IDEasy we currently define ide as an alias to sourcing a script.
For auto-completion we also hook in via a sourced bash script (source $IDE_ROOT/_ide/completion).
With #778 a new such command is to be added that also needs autocompletion.

An alternative could be to use bash functions instead:

  • Instead of having an ide script in $IDE_ROOT/_ide/bin we can have $IDE_ROOT/functions.
  • Instead of adding aliases, sourcing multiple scripts, etc. we would just add a source $IDE_ROOT/functions to .bashrc / .zshrc.
  • In functions we can also check if we are in zsh and install autocompletion to simplify setup and uninstallation of IDEasy if all we need might be a single line of code in .bashrc / .zshrc.
  • This functions "script" that is sourced can define bash functions such as ide and icd instead that we use alias for that.

IMHO this will simplify and increase flexibility for future extension (e.g. if we have more ideas like #778), since we only need to tweak .bashrc once and forever and newer releases of IDEasy can add new commands and completions all via functions.
The first step with this story should be an analysis and PoC testing if this plan works well or there are some drawbacks of this idea.
If all works as planned, we should implement it this way since it seems the superior design.

@hohwille hohwille added the enhancement New feature or request label Nov 20, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in IDEasy board Nov 20, 2024
@hohwille hohwille added bash completion auto-completion in bash or build in CLI CLI IDEasy command-line-interface (parsing args, etc.) labels Nov 20, 2024
@hohwille
Copy link
Member Author

For the record: I decided for High as priority since this is a refactoring that will impact existing installations on roll-out / upgrade.
If this approach works out, it is better to have it soon before many projects and users will start installing and using IDEasy.

@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.) completion auto-completion in bash or build in CLI enhancement New feature or request
Projects
Status: ✅ Done
1 participant