Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_cli: Create --verbose flag #185

Merged
merged 5 commits into from
Dec 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ A clear and concise description of what you expected to happen.

If applicable, add screenshots to help explain your problem.

Similarly, if applicable and possible, re-run the command with `PIP_AUDIT_LOGLEVEL=debug` exported,
Similarly, if applicable and possible, re-run the command with `--verbose`,
and paste the logs in the code block below:

```
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ All versions prior to 0.0.9 are untracked.
`pip-audit` entrypoint
([#173](https://github.com/trailofbits/pip-audit/pull/173))

* CLI: The `--verbose` flag has been added, allowing users to receive more
more verbose output from `pip-audit`. Supplying the `--verbose` flag
overrides the `PIP_AUDIT_LOGLEVEL` environment variable and is equivalent to
setting it to `debug`
([#185](https://github.com/trailofbits/pip-audit/pull/185))

### Changed

* CLI: `pip-audit` now clears its spinner bar from the terminal upon
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ python -m pip_audit --help
usage: pip-audit [-h] [-V] [-l] [-r REQUIREMENTS] [-f FORMAT] [-s SERVICE]
[-d] [-S] [--desc [{on,off,auto}]] [--cache-dir CACHE_DIR]
[--progress-spinner {on,off}] [--timeout TIMEOUT]
[--path PATHS]
[--path PATHS] [-v]

audit the Python environment for dependencies with known vulnerabilities

Expand Down Expand Up @@ -73,6 +73,9 @@ optional arguments:
--path PATHS restrict to the specified installation path for
auditing packages; this option can be used multiple
times (default: [])
-v, --verbose give more output; this setting overrides the
`PIP_AUDIT_LOGLEVEL` variable and is equivalent to
setting it to `debug` (default: False)
```
<!-- @end-pip-audit-help@ -->

Expand Down
11 changes: 11 additions & 0 deletions pip_audit/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,19 @@ def audit() -> None:
help="restrict to the specified installation path for auditing packages; "
"this option can be used multiple times",
)
parser.add_argument(
"-v",
"--verbose",
dest="verbose",
action="store_true",
help="give more output; this setting overrides the `PIP_AUDIT_LOGLEVEL` variable and is "
"equivalent to setting it to `debug`",
)

args = parser.parse_args()
if args.verbose:
logging.root.setLevel("DEBUG")

logger.debug(f"parsed arguments: {args}")

service = args.vulnerability_service.to_service(args.timeout, args.cache_dir)
Expand Down