๐Ÿ“ฆ Libraries

๐Ÿ“ฆ Libraries

๐Ÿงฉ Source libraries from your command function

Useful function are accessible by including a Valet library in your script or command function. For this, you need to source the library that you need, e.g.:

source string
source interactive

All Valet functions are prefixed with the library name. E.g. the function string::cutField is from the string library. A clear error message will be output if you are trying to use a library function without sourcing the library.

๐Ÿ’ก
The bash built-in source is overridden by a function in Valet. This allows to not source the same file twice, so you can safely call source mylibrary several times without impacting the runtime performance. If you need to use the default source keyword, use builtin source.

๐Ÿช„ Use Valet functions directly in bash

Thanks to the self export command, you can export Valet functions so they are usable directly in your bash session:

eval "$(valet self export -a)"

log::info "Cool logs!"
if interactive::promptYesNo "Do you want to continue?"; then echo "Yes."; else echo "No."; fi

๐ŸŽ€ Available libraries

For more details, please check the documentation on each library: