diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 19c0e4c..fc5ea64 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,6 +22,6 @@ jobs: - name: Install gepetuto and its dependencies run: python -m pip install -U pip && python -m pip install . - name: check with gepetuto - run: cd tests && gepetuto -vvca all + run: gepetuto -vvca all -C tests - name: run unit tests run: cd tests && python -m unittest diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a78cc4..bf273c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- add directory argument + ## [v1.1.1] - 2023-08-16 - updated pre-commit hooks diff --git a/gepetuto/main.py b/gepetuto/main.py index 5dc1ba5..ad83af4 100644 --- a/gepetuto/main.py +++ b/gepetuto/main.py @@ -67,6 +67,12 @@ def parse_args(args=None) -> argparse.Namespace: action="store_true", help="check if linters change files.", ) + parser.add_argument( + "-C", + "--directory", + default="", + help="choose directory to run action on.", + ) args = parser.parse_args(args=args) @@ -134,6 +140,9 @@ def get_files(args): def main(): """Run command.""" args = parse_args() + if args.directory: + os.chdir(args.directory) + args = parse_args() files = get_files(args) if args.action == "generate": generate(**vars(args))