]> git.tdb.fi Git - libs/net.git/blobdiff - examples/httpget.cpp
Update getopt usage with positional arguments
[libs/net.git] / examples / httpget.cpp
index a4314cef6e3ec12ee83114d36f3e6bd0a823ae71..18ef79933791849bd79dddaf307bf76285fa0e6a 100644 (file)
@@ -28,13 +28,8 @@ HttpGet::HttpGet(int argc, char **argv):
 {
        GetOpt getopt;
        getopt.add_option('v', "verbose", verbose, GetOpt::NO_ARG);
+       getopt.add_argument("url", url, GetOpt::REQUIRED_ARG);
        getopt(argc, argv);
-
-       const vector<string> &args = getopt.get_args();
-       if(args.empty())
-               throw usage_error("No URL");
-
-       url = args.front();
 }
 
 int HttpGet::main()