Re-Enable -v and -vv on dev_container

They have been dropped with the recent refactoring to not use argh.

BUG=None
TEST=./tools/dev_container -v

Change-Id: Ifa65b14d316e27dbb5cef9714fbd3adf110b79e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3664051
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Dennis Kempin 2022-05-24 23:26:23 +00:00
parent 6562f9d118
commit 69a55d5540
2 changed files with 4 additions and 3 deletions

View file

@ -24,7 +24,7 @@ import argparse
import getpass import getpass
import shutil import shutil
from typing import Tuple from typing import Tuple
from impl.common import CROSVM_ROOT, cmd, chdir, quoted from impl.common import CROSVM_ROOT, cmd, chdir, quoted, add_verbose_args
import sys import sys
CONTAINER_NAME = f"crosvm_dev_{getpass.getuser()}" CONTAINER_NAME = f"crosvm_dev_{getpass.getuser()}"
@ -145,6 +145,7 @@ if __name__ == "__main__":
parser.add_argument( parser.add_argument(
"command", nargs=argparse.REMAINDER, help="The command to execute in the container." "command", nargs=argparse.REMAINDER, help="The command to execute in the container."
) )
add_verbose_args(parser)
args = parser.parse_args() args = parser.parse_args()
main( main(
args.command, args.command,

View file

@ -481,7 +481,7 @@ def run_commands(*functions: Callable[..., Any], default_fn: Optional[Callable[.
try: try:
# Add global verbose arguments # Add global verbose arguments
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
__add_verbose_args(parser) add_verbose_args(parser)
# Add provided commands to parser. Do not use sub-commands if we just got one function. # Add provided commands to parser. Do not use sub-commands if we just got one function.
if functions: if functions:
@ -507,7 +507,7 @@ def very_verbose():
return "-vv" in sys.argv or "--very-verbose" in sys.argv return "-vv" in sys.argv or "--very-verbose" in sys.argv
def __add_verbose_args(parser: argparse.ArgumentParser): def add_verbose_args(parser: argparse.ArgumentParser):
# This just serves as documentation to argparse. The verbose variables are directly # This just serves as documentation to argparse. The verbose variables are directly
# parsed from argv above to ensure they are accessible early. # parsed from argv above to ensure they are accessible early.
parser.add_argument( parser.add_argument(