Added Truthy shortcut for return val.
I don't really like the feel of this but this allows us to call $(return_val_truthy) to output a value of tue or false based on the retrun value of the last command. This saves us from having to do make the call ` && echo true || echo false`. I will probaby switch this in the future to just have a `echo $?` function instead. Then check if returnVal == zero. If I do that I will also need to change the way OS works, requiring true => 0 and false => 1, which is a little bit conter to how it should be.
This commit is contained in:
parent
b7c64b5093
commit
e5b9486fb3
|
@ -11,7 +11,8 @@ LIB_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||||
mk_link := $(LIB_DIR)/helper/mk_link
|
mk_link := $(LIB_DIR)/helper/mk_link
|
||||||
rm_link := $(LIB_DIR)/helper/rm_link
|
rm_link := $(LIB_DIR)/helper/rm_link
|
||||||
report := LAST_RETURN=$$? $(LIB_DIR)/helper/report
|
report := LAST_RETURN=$$? $(LIB_DIR)/helper/report
|
||||||
cmd_exist = $(shell (($$+commands[$1])) && echo true || echo false )
|
return_val_truthy := && echo true || echo false
|
||||||
|
cmd_exist = $(shell (($$+commands[$1])) $(return_val_truthy) )
|
||||||
|
|
||||||
# Shortcut for the XDG dir if it exist. default to ~/.confg
|
# Shortcut for the XDG dir if it exist. default to ~/.confg
|
||||||
XDG_DIR := $${XDG_CONFIG_DIR:-~/.config}
|
XDG_DIR := $${XDG_CONFIG_DIR:-~/.config}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user