Contributing to has
July 29, 2025 ยท View on GitHub
Thank you for your interest in contributing! Please follow these guidelines to get started.
How to run locally
- Clone the repository:
git clone https://github.com/kdabir/has.git cd has chmod +x ./has - Run the main script:
Example:./has <command-names>./has git curl node - Install Prequisites for development
./has
running has from root of the project tells you about the pre-requisites required (because of .hasrc file)
How to run tests locally
- Install dependencies:
- On Ubuntu:
sudo apt-get update && sudo apt-get install -y bats make curl git - On Mac (using Homebrew):
brew install bats-core make curl git
- On Ubuntu:
- Run the unit test suite:
make test # or bats tests/unit/unit-tests.bats
Adding more tools
The current list of supported packages can be viewed with make list
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.
- commands that use
--versionflag ->__dynamic_detect--version() - commands that use
-versionflag ->__dynamic_detect-version() - commands that use
-vflag ->__dynamic_detect-v() - commands that use
-Vflag ->__dynamic_detect-V()
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.
Adding features
- If you are contributing a feature, please open an issue first to dicuss the idea.
- When implmenting, ensure to check current tests. Add test cases for your feature.
- Tests are executed using the excellent bats testing framework.
- Add tests and run
make test
Raise the PR and make sure the tests pass on GitHub Actions.
Looking for support to maintain docker based tests
I'm not expert at docker (or shell scripts for that matter). I need someone to look at tests/to-fix dir to help me
with integration tests for all tools installed in docker containers.
test_all_packages.batswill test every package has supports. This includes newly added commands so please add new packages toalpine.Dockerfileandubuntu.Dockerfileto install the tool ORpackages_alpine_skip.txtandpackages_ubuntu_skip.txtto exclude the package from the tests