Skip to content

Commit

Permalink
Change: dependency graph cli incorrect error and remove logging
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasHargarter committed Feb 11, 2025
1 parent 0641d90 commit 186ff56
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions troubadix/standalone_plugins/dependency_graph/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
# SPDX-FileCopyrightText: 2025 Greenbone AG


import logging
import os
from argparse import ArgumentError, ArgumentParser, ArgumentTypeError, Namespace
from argparse import ArgumentParser, ArgumentTypeError, Namespace
from pathlib import Path

from troubadix.argparser import directory_type_existing
Expand All @@ -24,10 +23,10 @@ def parse_args() -> Namespace:
description="Tool for analysing the dependencies in the NASL repository.",
)
parser.add_argument(
"root",
"-r",
"--root",
type=directory_type_existing,
default=os.environ.get("VTDIR"),
help="directory that should be linted",
help="root for nasl directory that should be linted, uses $VTDIR if no path is given",
)
parser.add_argument(
"-f",
Expand All @@ -50,10 +49,10 @@ def parse_args() -> Namespace:
if not args.root:
vtdir = os.environ.get("VTDIR")
if not vtdir:
raise ArgumentError(
"The environment variable 'VTDIR' is not set, and no path was provided."
raise ValueError(
"The environment variable 'VTDIR' is not set,"
" and no root path with '--root' was provided."
)
args.root = Path(vtdir)
logging.info(f"using root {vtdir} from 'VTDIR'")

return args

0 comments on commit 186ff56

Please sign in to comment.