Suppressing Errors in Variables -- and Checking Available Commands #1667
Unanswered
dream-dasher
asked this question in
Q&A
Replies: 1 comment
-
EDIT: Just: POETRY_COMMAND := `command -v poetry 2>/dev/null || echo "NOT_FOUND"`
ASDF_COMMAND := `command -v asdf 2>/dev/null || echo "NOT_FOUND"`
MADEUPJUNK_COMMAND := `command -v madeupjunk 2>/dev/null || echo "NOT_FOUND"` and this would be similar syntax for Make: HAS_POETRY := $(shell command -v poetry 2> /dev/null)
HAS_ASDF := $(shell command -v asdf 2> /dev/null)
HAS_MADEUPJUNK := $(shell command -v madeupjunk 2> /dev/null) Still curious on other approaches to local and general problem though! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Large Goal: Do conditional logic on presence or absence of commands. (e.g. if my user doesn't have a build system present or the right version of an interpreter installed I want to warn them or switch commands)
Small Goal: Get variables to ignore errors.
This fails:
This is a hacky workaround:
But besides being incredibly hacky, it also pollutes stderr on every command.
e.g.
> just anything sh: line 0: type: nothere: not found ...
So: can we suppress errors for variables?
Other good patterns for checking what commands are installed?
Beta Was this translation helpful? Give feedback.
All reactions