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/pkg-fetch.cxx | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'bpkg/pkg-fetch.cxx') 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 #include #include +#include #include @@ -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 () == 0) fail << "configuration " << c << " has no repositories" << -- cgit v1.1