Skip to content

Commit

Permalink
_cli: Create --verbose flag (#185)
Browse files Browse the repository at this point in the history
* _cli: Create --verbose flag

* README: Update help text

* CHANGELOG: Add changelog entry for `--verbose` flag

* bug_report: encourage people to use the `--verbose` flag

Co-authored-by: William Woodruff <[email protected]>
Co-authored-by: William Woodruff <[email protected]>
  • Loading branch information
3 people authored Dec 6, 2021
1 parent a280852 commit 2bef7d6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
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

0 comments on commit 2bef7d6

Please sign in to comment.