Currently, the tool fails to launch outside of a git repository. It simply prints an error message, for all commands.
To Reproduce
Steps to reproduce the behavior:
pip install git-plan
mkdir some_dir
cd some_dir
git-plan --version
Expected behavior
There should be git-plan 0.2.0 output.
Additional context
The core problem is that NotAGitRepository is raised from settings.load()here, which happens before the CLI is launched. The --version flag is therefore never processed.
One possible solution is to set settings["project_root"] to None in settings.load() if the exception is raised, and also make it optional in Project model. Then, individual commands can check project.is_a_git_repository() and fail if needed.
Another is to run a simple argparse in __cli__.py just to handle the --version flag. That is a little ugly, so I prefer the first option.
Describe the bug
Currently, the tool fails to launch outside of a git repository. It simply prints an error message, for all commands.
To Reproduce
Steps to reproduce the behavior:
pip install git-plan
mkdir some_dir
cd some_dir
git-plan --version
Expected behavior
There should be
git-plan 0.2.0
output.Additional context
The core problem is that
NotAGitRepository
is raised fromsettings.load()
here, which happens before the CLI is launched. The--version
flag is therefore never processed.One possible solution is to set
settings["project_root"]
toNone
insettings.load()
if the exception is raised, and also make it optional inProject
model. Then, individual commands can checkproject.is_a_git_repository()
and fail if needed.Another is to run a simple
argparse
in__cli__.py
just to handle the--version
flag. That is a little ugly, so I prefer the first option.@JBizarri