aboutsummaryrefslogtreecommitdiff
path: root/bdep/new.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-03-25 10:07:31 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-03-25 10:07:31 +0200
commite2b8f68fcae70fca5971167613916a1aa9480817 (patch)
tree3e4b63695de7855d71082aa1abd090e10825de2a /bdep/new.cxx
parent234428e21adde0ddf60f9665edad3dcfb9fd2584 (diff)
Document new command, use --vcs|-s instead of --no-git
Diffstat (limited to 'bdep/new.cxx')
-rw-r--r--bdep/new.cxx20
1 files changed, 14 insertions, 6 deletions
diff --git a/bdep/new.cxx b/bdep/new.cxx
index 9ab63f4..3e3b3b8 100644
--- a/bdep/new.cxx
+++ b/bdep/new.cxx
@@ -16,6 +16,7 @@ namespace bdep
{
using type = cmd_new_type;
using lang = cmd_new_lang;
+ using vcs = cmd_new_vcs;
int
cmd_new (const cmd_new_options& o, cli::scanner& args)
@@ -68,6 +69,10 @@ namespace bdep
}
}
+ // Validate type options.
+ //
+ const vcs& s (o.vcs ());
+
// Validate argument.
//
string n (args.more () ? args.next () : "");
@@ -90,11 +95,14 @@ namespace bdep
else if (!empty (prj))
fail << "directory " << prj << " already exists";
- // Initialize the git repository. Do it before writing anything ourselves
- // in case it fails.
+ // Initialize the version control system. Do it before writing anything
+ // ourselves in case it fails.
//
- if (!o.no_git ())
- run ("git", "init", "-q", prj);
+ switch (s)
+ {
+ case vcs::git: run ("git", "init", "-q", prj); break;
+ case vcs::none: break;
+ }
path f; // File currently being written.
try
@@ -186,7 +194,7 @@ namespace bdep
// build/.gitignore
//
- if (!o.no_git ())
+ if (s == vcs::git)
{
os.open (f = bd / ".gitignore");
os << "config.build" << endl
@@ -202,7 +210,7 @@ namespace bdep
// .gitignore
//
- if (!o.no_git ())
+ if (s == vcs::git)
{
// Use POSIX directory separators here.
//