has/README.md

211 lines
5.9 KiB
Markdown
Raw Permalink Normal View History

# has
2014-03-04 23:16:26 +01:00
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
`has` checks presence of various command line tools on the PATH and reports their installed version.
2014-03-04 23:16:26 +01:00
2023-07-28 15:30:34 +02:00
[![Build Status](https://github.com/kdabir/has/actions/workflows/main.yml/badge.svg)](https://github.com/kdabir/has/actions/workflows/main.yml)
Add CodeTriage badge to kdabir/has Adds a badge showing the number of people helping this repo on CodeTriage. [![Open Source Helpers](https://www.codetriage.com/kdabir/has/badges/users.svg)](https://www.codetriage.com/kdabir/has) ## What is CodeTriage? CodeTriage is an Open Source app that is designed to make contributing to Open Source projects easier. It works by sending subscribers a few open issues in their inbox. If subscribers get busy, there is an algorithm that backs off issue load so they do not get overwhelmed [Read more about the CodeTriage project](https://www.codetriage.com/what). ## Why am I getting this PR? Your project was picked by the human, @schneems. They selected it from the projects submitted to https://www.codetriage.com and hand edited the PR. How did your project get added to [CodeTriage](https://www.codetriage.com/what)? Roughly 4 months ago, [@kdabir](https://github.com/kdabir) added this project to CodeTriage in order to start contributing. ## What does adding a badge accomplish? Adding a badge invites people to help contribute to your project. It also lets developers know that others are invested in the longterm success and maintainability of the project. You can see an example of a CodeTriage badge on these popular OSS READMEs: - [![](https://www.codetriage.com/rails/rails/badges/users.svg)](https://www.codetriage.com/rails/rails) https://github.com/rails/rails - [![](https://www.codetriage.com/crystal-lang/crystal/badges/users.svg)](https://www.codetriage.com/crystal-lang/crystal) https://github.com/crystal-lang/crystal ## Have a question or comment? While I am a bot, this PR was manually reviewed and monitored by a human - @schneems. My job is writing commit messages and handling PR logistics. If you have any questions, you can reply back to this PR and they will be answered by @schneems. If you do not want a badge right now, no worries, close the PR, you will not hear from me again. Thanks for making your project Open Source! Any feedback is greatly appreciated.
2018-02-03 22:52:36 +01:00
[![Open Source Helpers](https://www.codetriage.com/kdabir/has/badges/users.svg)](https://www.codetriage.com/kdabir/has)
2018-01-31 05:00:14 +01:00
[![demo](demo.svg)](demo.svg)
2019-07-13 10:51:20 +02:00
## Quick Start 🚴
2014-03-04 23:16:26 +01:00
2019-07-13 10:51:20 +02:00
Just [install](#installing) the `has` script, (there is no dependency apart from `bash` itself). From the command line, pass the list of commands you want to check as arguments to `has`, for example:
2014-03-04 23:16:26 +01:00
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
```console
$ 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
2019-07-13 10:41:04 +02:00
If everything is good `has` exits with status code `0`. The exit status code reflects number of commands **not found** on your path.
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
```console
$ has node go javac
✔ node 8.2.1
✔ go 1.8.3
✘ javac
```
And echo the status:
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
```console
$ echo $?
1
```
2019-07-13 10:41:04 +02:00
## Use `has` in scripts
`has` can be used in shell scripts to check presence of tool in very readable way
```bash
if has node
then echo you have what it takes 🎉
fi
```
**Pro Tip**: the `has` in above command can be replaced with the entire curl command for to ensure portability of script → `if curl -sL https://git.io/_has | bash -s node then ...`
## Installing 🚀
2017-08-28 18:57:04 +02:00
2019-07-13 10:51:20 +02:00
`has` is a single bash script that does it all. You can [download](https://raw.githubusercontent.com/kdabir/has/master/has) the script and make it available on your `$PATH`. However, to make it even simpler, just follow *one* of these methods.
2018-11-17 06:21:49 +01:00
2019-07-13 10:51:20 +02:00
### Homebrew (MacOS) 🍺
Just run the following:
```bash
brew install kdabir/tap/has
```
2018-11-17 06:21:49 +01:00
### Cloning the Repo
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
Just execute the following command in a terminal: it clones `has` repo and installs it into your path.
2017-08-28 18:57:04 +02:00
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
```bash
git clone https://github.com/kdabir/has.git && cd has && sudo make install
```
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
For a non-root installation:
```bash
git clone https://github.com/kdabir/has.git
cd has
make PREFIX=$HOME/.local install
```
To update just do a `git fetch` or `make update` followed by the appropriate `make install` command.
2018-11-17 06:21:49 +01:00
2018-11-27 04:00:33 +01:00
### Downloading to a file
2018-11-17 06:21:49 +01:00
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
```bash
curl -sL https://git.io/_has > /usr/local/bin/has
```
2018-11-17 06:21:49 +01:00
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
```bash
curl -sL https://git.io/_has | sudo tee /usr/local/bin/has >/dev/null
```
2018-11-17 06:21:49 +01:00
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
These commands are safe to be called multiple times as well (to update `has`)
### asdf users
```
asdf plugin add has https://github.com/sylvainmetayer/asdf-has
asdf install has 1.4.0
```
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
### Running directly off the Internet
2017-08-28 18:57:04 +02:00
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
If you are lazy, you can run `has` directly off the Internet as well:
2017-08-28 18:57:04 +02:00
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
```console
curl -sL https://git.io/_has | bash -s git node npm
✔ git 2.17.1
✔ node 11.11.0
✔ npm 6.7.0
```
2017-08-28 18:57:04 +02:00
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
**ProTip**: if that's too much typing every time, setup an alias in your `.bashrc`/`.zshrc` file:
```.bashrc
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
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
```console
$ has git
✔ git 2.17.1
$ type has
has is aliased to `curl -sL https://git.io/_has | bash -s'
```
2017-08-28 18:57:04 +02:00
2018-11-27 04:00:33 +01:00
## Command not understood by has?
Let's say `$ has foobar` returns `foobar not understood`, because `has` may not have whitelisted `foobar`.
2023-07-28 14:53:47 +02:00
In such cases, pass `HAS_ALLOW_UNSAFE=y has foobar`. This should still check for existence of `foobar` and tries to detect version as well.
2017-10-14 08:58:53 +02:00
2019-07-13 10:51:20 +02:00
> the value must exactly be `y` for it to work.
2018-11-27 04:00:33 +01:00
## The `.hasrc` file
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
`has` looks for `.hasrc` file in the directory from where `has` command is issued. This file can contain commands that `has`
will check for. List one command per line. Lines starting with `#` are treated as comments.
Following is example of `.hasrc` file:
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
```hs
# tools
git
curl
# interpreters
ruby
node
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
```
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
When `has` is run in directory containing this file, it produces:
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
```console
$ has
✔ git 2.19.1
✔ curl 7.54.0
✔ ruby 2.3.1
✔ node 10.7.0
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
```
Also, CLI arguments passed to `has` are additive to `.hasrc` file. For example, in the same dir, if the following command is fired,
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
`has` checks for both commands passed from cli args and provided in `.hasrc` file.
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
```bash
$ has java
✔ java 11.0.1
✔ git 2.19.1
✔ curl 7.54.0
✔ ruby 2.3.1
✔ node 10.7.0
```
2018-11-17 06:21:49 +01:00
**Pro Tip**: commit `.hasrc` file in root of your project. This can work as a quick check for confirming presence all command
2018-11-16 12:49:46 +01:00
line tools required to build and run your project.
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
On machines that don't even have `has` installed, your project's `.hasrc` is honored by this command:
2018-11-16 12:49:46 +01:00
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
`curl -sL https://git.io/_has | bash -s`
2018-11-16 12:49:46 +01:00
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
> take a look at [.hasrc](https://github.com/kdabir/has/blob/master/.hasrc) file for this repo.
2017-10-14 08:58:53 +02:00
## Contributing
2017-08-28 19:20:44 +02:00
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
1. Star the repo, tweet about it, spread the word
2017-10-14 08:58:53 +02:00
2. Update the documentation (i.e. the README file)
3. Adding support for more commands
4. Adding more features to `has`
2017-08-31 11:17:13 +02:00
2019-07-24 14:26:00 +02:00
## Adding more tools
The current list of supported packages can be viewed with `bash tests/packages_all.sh`
2019-07-24 14:26:00 +02:00
If the command you wish to include supports any of `-v`, `--version`, `-version`, `version`, `-V` then you can find
corresponding function which can be called to check presence and extract version. However, for many tools version
extraction may not work and you will need to add custom parsing of command's output. The `has` script is commented
to guide developers about what needs to be done to add more tools.
`/tests/test_all_packages.bats` will test every package has supports. This includes newly added commands so please add new packages to
- `alpine.Dockerfile` and `ubuntu.Dockerfile` to install the tool OR
- `packages_alpine_skip.txt` and `packages_ubuntu_skip.txt` to exclude the package from the tests
2019-07-24 14:26:00 +02:00
## Adding Features
If you are contributing a feature, please ensure to check current tests. Add test cases for your feature. Tests are
2018-11-16 14:13:35 +01:00
executed using the excellent [bats](https://github.com/bats-core/bats-core) testing framework. Add tests and run `make test`
Raise the PR and **make sure the tests pass** on [GitHub Actions](https://github.com/kdabir/has/actions).
Freshen Makefile and update README.md (#31) Details: * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permission mode The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets * Freshen Makefile and update README.md - [x] Add `sudo` to revelvant commands - [x] Use named languages (bash) in fenced codeblocks - [x] Use `console` in fenced codeblocks for command output - [x] Use `install` with permissions set The permissions on `has` were 777 from `git clone`. - [x] Add option to use $PREFIX What if I don't want to install to /usr/local/bin? `make PREFIX=$HOME/.local install` now works. - [x] Add `update` target for `git pull` - [x] Include .PHONY targets - [x] Add tests for Makefile changes - [x] Uses `bats` variables for directories - ✓ make install creates a valid installation - ✓ ..even if has is missing from directory - ✓ make update runs git pull * Update .hastest.bats temp remove "git pull" check. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Change version output to non-blinking. * Update travis to use bats-core 1.10 Do not be concerned about dirty working tree when running make update. * Working makefile * Use `[[` and `@` for the $lines match. * `make install` MacOS friendly again
2019-04-04 12:39:17 +02:00
### ♥