diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-05-14 16:06:18 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-05-14 16:06:18 +0200 |
commit | 61cdde35094fc655eac2e6968b465f217e91d0ac (patch) | |
tree | 876719f9c98b51ca4503d9cc906f82c8e1dd1a70 | |
parent | a2e7f2beb522d9c7cda01ecfcb552d8e0c46b088 (diff) |
Add --wipe option to configuration creating commands
-rw-r--r-- | bdep/config.cxx | 13 | ||||
-rw-r--r-- | bdep/init.cxx | 3 | ||||
-rw-r--r-- | bdep/new.cxx | 3 | ||||
-rw-r--r-- | bdep/project.cli | 6 |
4 files changed, 23 insertions, 2 deletions
diff --git a/bdep/config.cxx b/bdep/config.cxx index 28289fb..70441cc 100644 --- a/bdep/config.cxx +++ b/bdep/config.cxx @@ -174,7 +174,12 @@ namespace bdep while (cfg_args.more ()) args.push_back (cfg_args.next ()); - run_bpkg (2, co, "create", "-d", path, args); + run_bpkg (2, + co, + "create", + "-d", path, + (ao.wipe () ? "--wipe" : nullptr), + args); } return cmd_config_add (ao, @@ -233,7 +238,8 @@ namespace bdep o.forward () ? "--forward" : o.no_forward () ? "--no-forward" : o.auto_sync () ? "--auto-sync" : - o.no_auto_sync () ? "--no-auto-sync" : nullptr); + o.no_auto_sync () ? "--no-auto-sync" : + o.wipe () ? "--wipe" : nullptr); } int @@ -252,6 +258,9 @@ namespace bdep { if (!(c.add () || c.create () || c.set ())) fail << n << " not valid for this command"; + + if (o.wipe () && !c.create ()) + fail << "--wipe is not valid for this command"; } // --all diff --git a/bdep/init.cxx b/bdep/init.cxx index 9fe4334..1ea55e9 100644 --- a/bdep/init.cxx +++ b/bdep/init.cxx @@ -148,6 +148,9 @@ namespace bdep { if (!ca && !cc) fail << n << " specified without --config-(add|create)"; + + if (o.wipe () && !cc) + fail << "--wipe specified without --config-create"; } project_packages pp ( diff --git a/bdep/new.cxx b/bdep/new.cxx index b04aba3..7b579fa 100644 --- a/bdep/new.cxx +++ b/bdep/new.cxx @@ -44,6 +44,9 @@ namespace bdep { if (!ca && !cc) fail << n << " specified without --config-(add|create)"; + + if (o.wipe () && !cc) + fail << "--wipe specified without --config-create"; } // Validate type options. diff --git a/bdep/project.cli b/bdep/project.cli index e62daf2..0053c19 100644 --- a/bdep/project.cli +++ b/bdep/project.cli @@ -42,6 +42,12 @@ namespace bdep "Don't make the added or created configuration automatically synchronized." } + + bool --wipe + { + "Wipe the configuration directory clean before creating the new + configuration." + } }; // Common options for commands that accept --config-id and @<cfg-name>. |