aboutsummaryrefslogtreecommitdiff
path: root/bpkg/rep-info.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-09-28 08:38:40 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-09-28 08:38:40 +0200
commit749cd532f72108b26a78cd2f0012e6abd72b3ce8 (patch)
treedf9f424dba608536cf77c3d188a53df89a4b6440 /bpkg/rep-info.cxx
parentc602595c08efae5ff1b05e0b8c7d4ab430f8f033 (diff)
Factory common code for version, repository location parsing
Diffstat (limited to 'bpkg/rep-info.cxx')
-rw-r--r--bpkg/rep-info.cxx20
1 files changed, 2 insertions, 18 deletions
diff --git a/bpkg/rep-info.cxx b/bpkg/rep-info.cxx
index 64ac9b1..224866c 100644
--- a/bpkg/rep-info.cxx
+++ b/bpkg/rep-info.cxx
@@ -14,6 +14,7 @@
#include <bpkg/types>
#include <bpkg/utility>
#include <bpkg/diagnostics>
+#include <bpkg/manifest-utility>
using namespace std;
using namespace butl;
@@ -29,24 +30,7 @@ namespace bpkg
fail << "repository location argument expected" <<
info << "run 'bpkg help rep-info' for more information";
- // Figure out the repository location.
- //
- // @@ The same code as in rep-add, factor out.
- //
- 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 ()));
// Fetch everything we will need before printing anything.
//