has/README.md

68 lines
1.5 KiB
Markdown
Raw Normal View History

# has
2014-03-04 23:16:26 +01:00
2017-08-31 18:16:24 +02:00
`has` checks presence of various command line tools and their versions on the path
2014-03-04 23:16:26 +01:00
2015-03-02 05:28:18 +01:00
## How ?
2014-03-04 23:16:26 +01:00
Download the `has` file. There is no dependency apart from `bash` itself
2014-03-04 23:16:26 +01:00
$ has node npm java git gradle
✔ node 8.2.1
✔ npm 5.3.0
✔ java 1.8.0
✔ git 2.14.1
✔ gradle 4.0.1
2014-03-04 23:16:26 +01:00
2017-08-31 16:59:01 +02:00
If everything is good `has` exits with status code `0`. The status code
reflects number of commands **not found** on your path.
$ has node go javac
✔ node 8.2.1
✔ go 1.8.3
✘ javac
And echo the status:
$ echo $?
1
2017-08-28 18:57:04 +02:00
## Installing
Just download the `has` script in your path.
git clone https://github.com/kdabir/has.git && cd has && make install
If you are lazy, you can run `has` directly off the internet as well:
2017-08-28 18:57:04 +02:00
2017-08-29 14:47:59 +02:00
curl -sL https://git.io/_has | bash -s git node npm
2017-08-28 18:57:04 +02:00
✔ git 2.14.1
✔ node 8.2.1
✔ npm 5.3.0
And if that's too much of typing every time, setup an alias
2017-08-28 18:57:04 +02:00
2017-08-29 14:47:59 +02:00
alias has="curl -sL https://git.io/_has | bash -s"
2017-08-28 18:57:04 +02:00
2017-08-31 16:59:01 +02:00
And use it
2017-08-28 18:57:04 +02:00
$ has git
✔ git 2.14.1
## command not understood by has?
Let's say `$ has foobar` returns `foobar not understood`, because `has` may not have whitelisted `foobar`.
In such cases, pass `HAS_ALLOW_UNSAFE=y has foobar`. This is should still check for existance of `foobar` and tries to detect version as well.
2017-08-28 18:57:04 +02:00
2014-03-04 23:16:26 +01:00
### ♥
2017-08-28 19:20:44 +02:00
[![Build Status](https://travis-ci.org/kdabir/has.svg?branch=has)](https://travis-ci.org/kdabir/has)
2017-08-31 11:17:13 +02:00
## Demo
2017-08-31 14:50:37 +02:00
[![asciicast](https://asciinema.org/a/135790.png)](https://asciinema.org/a/135790)