Skip to content

Report all missing dependencies at once #582

@DannyBen

Description

@DannyBen

Discussed in #580

Originally posted by meleu December 24, 2024
First of all: WOW! 😮

As bash-lover for more than 2 decades, I'm amazed by this project! This is a life-changing tool! Thanks for sharing it with us! ❤️

Now the feature idea:


When the script has more than one dependency and the user doesn't have any of them installed, it is a frustrating experience to see only one "missing dependency" notification at each time you try to run the script.

It would be nice if the dependency checking could report all missing dependencies in a single run.

I'm sharing here what I usually do (in a hope it can give you some ideas):

# declare the dependencies in an array
readonly DEPENDENCIES=(dep1 dep2 depN)

# checkDependencies:
# prints the missing dependency
# finishes with failure status when a missing dependency is found
checkDependencies() {
  local dep
  local failure=false

  for dep in "${DEPENDENCIES[@]}"; do
    command -v "$dep" > /dev/null && continue
    echo "[ERROR]: '$dep' is not in your PATH" >&2
    failure=true
  done

  [[ "$failure" == 'false' ]]
}
```</div>

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions