aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-05-05 17:38:25 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-05-05 17:38:25 +0200
commit0b2f299cd3a9db3744a79ca71edb793f5686f236 (patch)
tree5c047b29695b830bcc6223e7e0afba8a235d3621
parent322545a2d0ee46025bccdddfb96406332f97fe1f (diff)
Allow overriding project directory in new command
-rw-r--r--bdep/new.cli8
-rw-r--r--bdep/new.cxx3
2 files changed, 9 insertions, 2 deletions
diff --git a/bdep/new.cli b/bdep/new.cli
index faad002..c46f57d 100644
--- a/bdep/new.cli
+++ b/bdep/new.cli
@@ -37,7 +37,7 @@ namespace bdep
The \cb{new} command creates and initializes a new \cb{build2} project.
All three forms first create according to <spec> a new \cb{build2}
project called <name> in the <name> subdirectory of the current working
- directory.
+ directory (unless overriden with \c{\b{--directory}|\b{-d}}).
The first form then, unless the \cb{--no-init} option is specified,
initializes an empty project database as if by executing the
@@ -203,5 +203,11 @@ namespace bdep
\cb{git} (default) and \cb{none}. Valid values for <opt> are
system-specific."
}
+
+ dir_path --directory|-d
+ {
+ "<dir>",
+ "Create the project in the specified directory."
+ }
};
}
diff --git a/bdep/new.cxx b/bdep/new.cxx
index ce6d1ca..7589dca 100644
--- a/bdep/new.cxx
+++ b/bdep/new.cxx
@@ -97,8 +97,9 @@ namespace bdep
else
s = n;
- dir_path prj (n);
+ dir_path prj (o.directory_specified () ? o.directory () : dir_path (n));
prj.complete ();
+ prj.normalize ();
// If the directory already exists, make sure it is empty. Otherwise
// create it.