1 ////////////////////////////////////////////////////////////////////////
2 // FILE: httpupargparser.cpp
3 // AUTHOR: Johannes Winkelmann, jw@tks6.net
4 // COPYRIGHT: (c) 2005 by Johannes Winkelmann
5 // ---------------------------------------------------------------------
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 ////////////////////////////////////////////////////////////////////////
11
12
13 #include "httpupargparser.h"
14
15 ArgParser::APCmd HttpupArgparser::CMD_SYNC;
16 ArgParser::APCmd HttpupArgparser::CMD_COPY;
17 ArgParser::APCmd HttpupArgparser::CMD_LIST;
18
19 ArgParser::APOpt HttpupArgparser::OPT_REPOFILE;
20 ArgParser::APOpt HttpupArgparser::OPT_ENCODE;
21 ArgParser::APOpt HttpupArgparser::OPT_VERIFY_MD5;
22 ArgParser::APOpt HttpupArgparser::OPT_INSECURE_SSL;
23
24
25 HttpupArgparser::HttpupArgparser()
26 {
27 // - sync
28 addCommand(CMD_SYNC, "sync",
29 "syncronize local copy with remote repository",
30 ArgParser::MAX, 2, "[url] [target dir]");
31
32 OPT_REPOFILE.init("repofile",
33 'r',
34 "alternative name for REPO file",
35 true,
36 "NAME");
37
38 OPT_ENCODE.init("encode",
39 'e',
40 "encode special chars in URL");
41
42 OPT_VERIFY_MD5.init("verify-md5",
43 'm',
44 "verify md5sum of downloaded files");
45
46 OPT_INSECURE_SSL.init("insecure-ssl",
47 'k',
48 "Don't verify the SSL certificate of the server");
49 addOption(CMD_SYNC, OPT_REPOFILE, false);
50 addOption(CMD_SYNC, OPT_ENCODE, false);
51 addOption(CMD_SYNC, OPT_VERIFY_MD5, false);
52 addOption(CMD_SYNC, OPT_INSECURE_SSL, false);
53
54
55 // - copy
56 addCommand(CMD_COPY, "copy",
57 "copy a remote repository to a local directory",
58 ArgParser::EQ, 2, "<url> <target dir>");
59 addOption(CMD_COPY, OPT_REPOFILE, false);
60 addOption(CMD_COPY, OPT_ENCODE, false);
61 addOption(CMD_COPY, OPT_VERIFY_MD5, false);
62 addOption(CMD_COPY, OPT_INSECURE_SSL, false);
63
64 // - list
65 addCommand(CMD_LIST, "list",
66 "list files in <directory> which are controlled by httpup",
67 ArgParser::MAX, 1, "<directory>");
68 addOption(CMD_LIST, OPT_REPOFILE, false);
69 addOption(CMD_LIST, OPT_INSECURE_SSL, false);
70 }
|