has
is the programmer's version of the Unix test
tool. It allows querying a
wider variety of properties from the local computer than just the file system.
Examples are the configuration of the codebases in the local folder as well as
the status and configuration of source code management and build systems for
them. The general usage is:
has [no] <condition>
has
indicates the result of the check through its exit code: 0
means
success, any non-zero exit code indicates the given condition is not met. The
optional no
argument inverts the condition, i.e. checks for absence of the
condition.
has command-output <command> [args...]
: the given shell command prints something to STDOUThas file <glob>
: file with a matching namehas file <glob> --containing <text>
: file with matching name and contenthas file <glob> --matching <regex>
: file with matching name and content matching the given regexhas folder <name>
: folder with the given namehas git-branch <branch name>
: a Git branch with the given namehas git-branch-active <branch name>
: the currently checked out Git branch has the given namehas git-branch-inactive <branch name>
: a Git branch with the given name that is not checked outhas git-changes-uncommitted
: the local Git workspace contains uncommitted changeshas git-commits-by-author
: the local Git workspace contains commits by the given personhas git-commits-unpushed
: unpushed commits in the local Git workspacehas make-target <name>
: the Makefile contains the given targethas nodejs-dependency <name>
: a Node.JS codebase using the given production dependencyhas nodejs-dev-dependency <name>
: a Node.JS codebase using the given development dependency