Skip to content

Commit

Permalink
add show copyright license options.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gzh0821 committed Oct 24, 2022
1 parent 23af7bd commit 06c71f9
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,44 @@ int main(int argc, char **argv) {
std::ios::sync_with_stdio();

par.set_program_name("OStask");

par.add<unsigned long>("inquire", 'i', "Inquire the selected process info.",
false, ost::PID_MIN, cmdline::range<unsigned long>(ost::PID_MIN, ost::PID_MAX));
par.add("help", '?', "show help message.");
par.add("all", 'a', "show all info.");
par.add<unsigned int>("loop", 'l', "loop this program from [1-65535] second.",
false, ost::MIN_TIME, cmdline::range(ost::MIN_TIME, ost::MAX_TIME));
par.add<int>("type", 'y', "Set the show byte type[0=B,1=KB,2=MB,3=GB],Auto decide if not use this.",
false, ost::DEFAULT_BTYPE, cmdline::range(0, 3));

par.add("help", '?', "show help message.");
par.add("copyright", 'c', "show copyright and license information.");
par.add("all", 'a', "show all info.");

for (auto &&[arg, arf]: ost::funcMap) {
par.add(arg, arf.shortName, arf.desc);
}
if (argc <= 1 || !par.parse(argc, argv) || par.exist("help")) {
std::cout << par.error() << par.usage();
return 0;
}
if (par.exist("copyright")) {
std::cout << "[LICENSE]:\n"
"\n"
"Copyright 2022 Gzh0821/Gaozih\n"
"\n"
"Licensed under the Apache License, Version 2.0 (the \"License\");\n"
"you may not use this file except in compliance with the License.\n"
"You may obtain a copy of the License at\n"
"\n"
"http://www.apache.org/licenses/LICENSE-2.0\n"
"\n"
"Unless required by applicable law or agreed to in writing, software\n"
"distributed under the License is distributed on an \"AS IS\" BASIS,\n"
"WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"
"See the License for the specific language governing permissions and\n"
"limitations under the License.\n"
"\n";
return 0;
}
if (par.exist("type")) {
int type = par.get<int>("type");
ost::divByte.first = ost::BTYPE_NAME[type];
Expand Down

0 comments on commit 06c71f9

Please sign in to comment.