diff --git a/main.cpp b/main.cpp index 3d8918b..0ff7cad 100644 --- a/main.cpp +++ b/main.cpp @@ -36,14 +36,18 @@ int main(int argc, char **argv) { std::ios::sync_with_stdio(); par.set_program_name("OStask"); + par.add("inquire", 'i', "Inquire the selected process info.", false, ost::PID_MIN, cmdline::range(ost::PID_MIN, ost::PID_MAX)); - par.add("help", '?', "show help message."); - par.add("all", 'a', "show all info."); par.add("loop", 'l', "loop this program from [1-65535] second.", false, ost::MIN_TIME, cmdline::range(ost::MIN_TIME, ost::MAX_TIME)); par.add("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); } @@ -51,6 +55,25 @@ int main(int argc, char **argv) { 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("type"); ost::divByte.first = ost::BTYPE_NAME[type];