1 /**
2  * UGENE - Integrated Bioinformatics Tools.
3  * Copyright (C) 2008-2021 UniPro <ugene@unipro.ru>
4  * http://ugene.net
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  */
21 
22 #include "CMDLineCoreOptions.h"
23 
24 #include <U2Core/AppContext.h>
25 #include <U2Core/CMDLineHelpProvider.h>
26 #include <U2Core/CMDLineRegistry.h>
27 
28 namespace U2 {
29 
30 const QString CMDLineCoreOptions::INI_FILE = "ini-file";
31 const QString CMDLineCoreOptions::SUITE_URLS = "test-suite";
32 const QString CMDLineCoreOptions::API_TEST_URLS = "api-test-suite";
33 const QString CMDLineCoreOptions::TEST_REPORT = "test-report";
34 const QString CMDLineCoreOptions::HELP = "help";
35 const QString CMDLineCoreOptions::HELP_SHORT = "h";
36 const QString CMDLineCoreOptions::TRANSLATION = "lang";
37 const QString CMDLineCoreOptions::TEST_THREADS = "test-threads";
38 const QString CMDLineCoreOptions::TEAMCITY_OUTPUT = "log-teamcity-out";
39 const QString CMDLineCoreOptions::LOG_FORMAT = "log-format";
40 const QString CMDLineCoreOptions::LOG_LEVEL = "log-level";
41 const QString CMDLineCoreOptions::CREATE_GUI_TEST = "create-gui-test";
42 const QString CMDLineCoreOptions::LAUNCH_GUI_TEST = "gui-test";
43 const QString CMDLineCoreOptions::LAUNCH_GUI_TEST_NO_IGNORED = "gui-test-no-ignored";
44 const QString CMDLineCoreOptions::LAUNCH_GUI_TEST_BATCH = "gui-test-batch";
45 const QString CMDLineCoreOptions::LAUNCH_GUI_TEST_SUITE = "gui-test-suite";
46 const QString CMDLineCoreOptions::LAUNCH_GUI_TEST_CRAZY_USER = "gui-test-crazy-user";
47 const QString CMDLineCoreOptions::USAGE = "usage";
48 const QString CMDLineCoreOptions::DOWNLOAD_DIR = "download-dir";
49 const QString CMDLineCoreOptions::CUSTOM_TOOLS_CONFIG_DIR = "custom-external-tool-config-dir";
50 const QString CMDLineCoreOptions::TMP_DIR = "tmp-dir";
51 const QString CMDLineCoreOptions::DEFAULT_DATA_DIR = "default-data-dir";
52 const QString CMDLineCoreOptions::FILE_STORAGE_DIR = "file-storage-dir";
53 const QString CMDLineCoreOptions::SESSION_DB = "session-db";
54 const QString CMDLineCoreOptions::USE_SAME_INI_FOR_TESTS = "use-same-ini-for-tests";
55 const QString CMDLineCoreOptions::DONT_USE_NATIVE_MENUBAR = "dont-use-native-menubar";
56 
initHelp()57 void CMDLineCoreOptions::initHelp() {
58     CMDLineRegistry *cmdLineRegistry = AppContext::getCMDLineRegistry();
59     assert(nullptr != cmdLineRegistry);
60 
61     CMDLineHelpProvider *helpSection = new CMDLineHelpProvider(
62         HELP,
63         tr("Shows help information."),
64         "",  // No full description
65         "",  // No arguments
66         HELP_SHORT);
67 
68     CMDLineHelpProvider *loadSettingsFileSection = new CMDLineHelpProvider(
69         INI_FILE,
70         tr("Loads UGENE configuration."),
71         tr("Loads configuration from the specified .ini file. By default the UGENE.ini file is used."),
72         tr("<path_to_file>"));
73 
74     CMDLineHelpProvider *translSection = new CMDLineHelpProvider(
75         TRANSLATION,
76         tr("Specifies the language to use."),
77         tr("Specifies the language to use. The following values are available: CS, EN, RU, ZH."),
78         tr("<language_code>"));
79 
80     CMDLineHelpProvider *tmpDirSection = new CMDLineHelpProvider(
81         TMP_DIR,
82         "Path to temporary folder",
83         "",
84         tr("<path_to_file>"));
85 
86     CMDLineHelpProvider *sessionDatabaseSection = new CMDLineHelpProvider(
87         SESSION_DB,
88         tr("Path to the session database file"),
89         tr("Session database is stored in the temporary file that is created for every UGENE run.\n"
90            "But it can be supplied with the command line argument.\n"
91            "If the supplied file does not exist it will be created.\n"
92            "The session database file is removed after closing of UGENE."),
93         tr("<path_to_file>"));
94 
95     cmdLineRegistry->registerCMDLineHelpProvider(helpSection);
96     cmdLineRegistry->registerCMDLineHelpProvider(loadSettingsFileSection);
97     cmdLineRegistry->registerCMDLineHelpProvider(translSection);
98     cmdLineRegistry->registerCMDLineHelpProvider(tmpDirSection);
99     cmdLineRegistry->registerCMDLineHelpProvider(sessionDatabaseSection);
100 }
101 
102 }  // namespace U2
103