From 8c02a507df36b4ba300a59aa31c8c1910b4e2982 Mon Sep 17 00:00:00 2001 From: Sebastien Luttringer Date: Thu, 16 Feb 2012 12:29:10 +0100 Subject: [PATCH] add --dry-run option to install command this allow to run parser script without running setup script useful to valid arguments without causing trouble --- bin/is | 13 ++++++++----- completion/bash/is | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/bin/is b/bin/is index 1cf1e35..c241232 100755 --- a/bin/is +++ b/bin/is @@ -340,11 +340,12 @@ def c_install(args): arrow("Parsing arguments") args = args.parser.parse_args() # run setup scripts - image.run_setup(namespace=args) - # compute building time - t1 = time.time() - dt = int(t1 - t0) - arrow("Install time: %s" % datetime.timedelta(seconds=dt)) + if not args.dry_run: + image.run_setup(namespace=args) + # compute building time + t1 = time.time() + dt = int(t1 - t0) + arrow("Install time: %s" % datetime.timedelta(seconds=dt)) def c_list(args): ''' @@ -603,6 +604,8 @@ def arg_parser_init(): # install command parser p = subparser.add_parser("install", add_help=False, help=c_install.__doc__.lower()) + p.add_argument("--dry-run", action="store_true", + help="doesn't execute setup scripts") p.add_argument("pattern", help="path|[repository/]image[:version]") p.set_defaults(func=c_install, parser=parser, install_parser=p) # list command parser diff --git a/completion/bash/is b/completion/bash/is index 77143a5..1f4288f 100644 --- a/completion/bash/is +++ b/completion/bash/is @@ -133,6 +133,7 @@ _is() { _local_repo ;; install) + [[ "$cur" == -* ]] && _opt '--dry-run' && return 0 _count_args (( args == 2 )) && _image (( args > 2 )) && _filedir -- GitLab