aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-08-20 09:09:22 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-08-20 09:09:22 +0200
commit4d79c195d440f807e84235a8184b04a9f633cf94 (patch)
tree3c0f4a2ba118a6ffc588f0852a4721e556bc52e2
parentba8e0b9f9866b47bc61b49323e4293ba90826e80 (diff)
Allow specifying config type with --type in bdep-config-create, bdep-init
-rw-r--r--bdep/config.cli7
-rw-r--r--bdep/config.cxx24
-rw-r--r--bdep/init.cxx6
-rw-r--r--bdep/new.cli3
-rw-r--r--bdep/new.cxx10
-rw-r--r--bdep/project.cli4
6 files changed, 32 insertions, 22 deletions
diff --git a/bdep/config.cli b/bdep/config.cli
index 17a8f41..7181ebc 100644
--- a/bdep/config.cli
+++ b/bdep/config.cli
@@ -80,9 +80,10 @@ namespace bdep
\
A configuration also has a type that is specified with the
- \cb{--config-type} option. If the type is not specified explicitly,
- then \cb{target} is assumed. See \l{bpkg-cfg-create(1)} for
- background on configuration types.
+ \cb{--type} option (or \cb{--config-type} from \l{bdep-new(1)}).
+ If the type is not specified explicitly, then \cb{target} is
+ assumed. See \l{bpkg-cfg-create(1)} for background on configuration
+ types.
Unless the \cb{--no-default} option is specified, the first added or
created build configuration of each type is designated as the
diff --git a/bdep/config.cxx b/bdep/config.cxx
index d705355..31f4c14 100644
--- a/bdep/config.cxx
+++ b/bdep/config.cxx
@@ -54,15 +54,15 @@ namespace bdep
if (o.existing () && o.wipe ())
fail << "both --existing|-e and --wipe specified";
- return (o.config_type_specified () ? "--config-type" :
- o.default_ () ? "--default" :
- o.no_default () ? "--no-default" :
- o.forward () ? "--forward" :
- o.no_forward () ? "--no-forward" :
- o.auto_sync () ? "--auto-sync" :
- o.no_auto_sync () ? "--no-auto-sync" :
- o.existing () ? "--existing|-e" :
- o.wipe () ? "--wipe" : nullptr);
+ return (o.type_specified () ? "--type|--config-type" :
+ o.default_ () ? "--default" :
+ o.no_default () ? "--no-default" :
+ o.forward () ? "--forward" :
+ o.no_forward () ? "--no-forward" :
+ o.auto_sync () ? "--auto-sync" :
+ o.no_auto_sync () ? "--no-auto-sync" :
+ o.existing () ? "--existing|-e" :
+ o.wipe () ? "--wipe" : nullptr);
}
void
@@ -668,7 +668,7 @@ namespace bdep
move (path),
cfg_args,
move (name),
- o.config_type (),
+ o.type (),
move (id));
return 0;
}
@@ -1142,8 +1142,8 @@ namespace bdep
if (!c.add () && !c.create () && !c.set ())
fail << n << " not valid for this subcommand";
- if (o.config_type_specified () && !c.create ())
- fail << "--config-type is not valid for this subcommand";
+ if (o.type_specified () && !c.create ())
+ fail << "--type|--config-type is not valid for this subcommand";
if (o.existing () && !c.create ())
fail << "--existing|-e is not valid for this subcommand";
diff --git a/bdep/init.cxx b/bdep/init.cxx
index a8d0658..067226b 100644
--- a/bdep/init.cxx
+++ b/bdep/init.cxx
@@ -307,7 +307,7 @@ namespace bdep
// Type of configuration being created, if --config-create is specified.
//
optional<string> cc (o.config_create_specified ()
- ? o.config_type ()
+ ? o.type ()
: optional<string> ());
if (o.empty ())
@@ -322,8 +322,8 @@ namespace bdep
if (!ca && !cc)
fail << n << " specified without --config-(add|create)";
- if (o.config_type_specified () && !cc)
- fail << "--config-type specified without --config-create";
+ if (o.type_specified () && !cc)
+ fail << "--type|--config-type specified without --config-create";
if (o.existing () && !cc)
fail << "--existing|-e specified without --config-create";
diff --git a/bdep/new.cli b/bdep/new.cli
index c948b8e..3ec489c 100644
--- a/bdep/new.cli
+++ b/bdep/new.cli
@@ -677,6 +677,9 @@ namespace bdep
\cb{--source}."
}
+ // Note that --type overrides --type|--config-type from
+ // configuration_add_options.
+ //
cmd_new_type --type|-t
{
"<type>[,<opt>...]",
diff --git a/bdep/new.cxx b/bdep/new.cxx
index 915e042..a8f3af7 100644
--- a/bdep/new.cxx
+++ b/bdep/new.cxx
@@ -245,8 +245,12 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
// Type of configuration being created, if --config-create is specified.
//
+ // Note that our --type|-t overrides --type|--config-type from
+ // configuration_add_options.
+ //
+ configuration_add_options& cao (o);
optional<string> cc (o.config_create_specified ()
- ? o.config_type ()
+ ? cao.type ()
: optional<string> ());
if (o.subdirectory ())
@@ -276,7 +280,9 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
if (!ca && !cc)
fail << n << " specified without --config-(add|create)";
- if (o.config_type_specified () && !cc)
+ // Note: no --type|... (see above).
+ //
+ if (cao.type_specified () && !cc)
fail << "--config-type specified without --config-create";
if (o.existing () && !cc)
diff --git a/bdep/project.cli b/bdep/project.cli
index 6a1c4f0..0c4b355 100644
--- a/bdep/project.cli
+++ b/bdep/project.cli
@@ -11,9 +11,9 @@ namespace bdep
//
class configuration_add_options
{
- string --config-type = "target"
+ string --type|--config-type = "target"
{
- "<type>",
+ "<typ>",
"The type of the configuration being created. By default, configuration
of type \cb{target} is created. See \l{bpkg-cfg-create(1)} for
background on configuration types."