aboutsummaryrefslogtreecommitdiff
path: root/bpkg/pkg-fetch.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/pkg-fetch.cxx
parentc602595c08efae5ff1b05e0b8c7d4ab430f8f033 (diff)
Factory common code for version, repository location parsing
Diffstat (limited to 'bpkg/pkg-fetch.cxx')
-rw-r--r--bpkg/pkg-fetch.cxx17
1 files changed, 2 insertions, 15 deletions
diff --git a/bpkg/pkg-fetch.cxx b/bpkg/pkg-fetch.cxx
index bfa6e54..1406d8d 100644
--- a/bpkg/pkg-fetch.cxx
+++ b/bpkg/pkg-fetch.cxx
@@ -13,6 +13,7 @@
#include <bpkg/utility>
#include <bpkg/database>
#include <bpkg/diagnostics>
+#include <bpkg/manifest-utility>
#include <bpkg/pkg-verify>
@@ -61,21 +62,7 @@ namespace bpkg
fail << "package version argument expected" <<
info << "run 'bpkg help pkg-fetch' for more information";
- //@@ Same code as in pkg-status. Similar problem to repo_location;
- // need a place for such utilities.
- //
- version v;
- {
- const char* s (args.next ());
- try
- {
- v = version (s);
- }
- catch (const invalid_argument& e)
- {
- fail << "invalid package version '" << s << "': " << e.what ();
- }
- }
+ version v (parse_version (args.next ()));
if (db.query_value<repository_count> () == 0)
fail << "configuration " << c << " has no repositories" <<