Given 2 versions, this CLI tool will will compare them and do the following:
- version1 > version2 return 1
- version1 < version2 return -1
- otherwise return 0
In the project directory execute
python -m venv ./venv
source venv/bin/activate
python -m pip install -r requirements.txt
- Compare 2 versions and display desired result
Compare the 2 versions the following command executed within the venv shell
python -m src compare
-v1 / --version1
for file path-v2 / --version2
for threshold configuration
To run tests
python -m pytest tests/
You can execute the command without providing any parameters and you will be prompted to enter the required parameters or leave as is/
- Input validation for versions to ensure that it won't accept other inputs
- Project structure could receive minor changes in case more commands are going to be added for readability and maintainability
- Typer is being used which is a very powerful package that can make user interactions with the CLI much better in case it's requried