From 749cd532f72108b26a78cd2f0012e6abd72b3ce8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 28 Sep 2015 08:38:40 +0200 Subject: Factory common code for version, repository location parsing --- bpkg/rep-add.cxx | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'bpkg/rep-add.cxx') diff --git a/bpkg/rep-add.cxx b/bpkg/rep-add.cxx index 924cd65..bed6b86 100644 --- a/bpkg/rep-add.cxx +++ b/bpkg/rep-add.cxx @@ -12,6 +12,7 @@ #include #include #include +#include using namespace std; using namespace butl; @@ -30,23 +31,7 @@ namespace bpkg fail << "repository location argument expected" << info << "run 'bpkg help rep-add' for more information"; - // Figure out the repository location. - // - const char* arg (args.next ()); - repository_location rl; - try - { - rl = repository_location (arg, repository_location ()); - - if (rl.relative ()) // Throws if location is empty. - rl = repository_location ( - dir_path (arg).complete ().normalize ().string ()); - } - catch (const invalid_argument& e) - { - fail << "invalid repository location '" << arg << "': " << e.what (); - } - + repository_location rl (parse_location (args.next ())); const string& rn (rl.canonical_name ()); // Create the new repository and add is as a complement to the root. -- cgit v1.1