From 0b2f299cd3a9db3744a79ca71edb793f5686f236 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 5 May 2018 17:38:25 +0200 Subject: Allow overriding project directory in new command --- bdep/new.cli | 8 +++++++- bdep/new.cxx | 3 ++- 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 a new \cb{build2} project called in the 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 are system-specific." } + + dir_path --directory|-d + { + "", + "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. -- cgit v1.1