aboutsummaryrefslogtreecommitdiff
path: root/lib/configuration/commandline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/configuration/commandline.cpp')
-rw-r--r--lib/configuration/commandline.cpp59
1 files changed, 0 insertions, 59 deletions
diff --git a/lib/configuration/commandline.cpp b/lib/configuration/commandline.cpp
deleted file mode 100644
index 4581c84..0000000
--- a/lib/configuration/commandline.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * This file is part of smolbote. It's copyrighted by the contributors recorded
- * in the version control history of the file, available from its original
- * location: https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote
- *
- * SPDX-License-Identifier: GPL-3.0
- */
-
-#include "commandline.h"
-#include "config.h"
-#include <QStandardPaths>
-
-namespace po = boost::program_options;
-
-inline std::string defaultUserConfigLocation()
-{
-#ifdef CONFIG_PATH_CONFIG
- return CONFIG_PATH_CONFIG;
-#else
- // try to locate an existing config
- QString path = QStandardPaths::locate(QStandardPaths::ConfigLocation, "smolbote/smolbote.cfg");
-
- // it's possible there is no config, so set the path properly
- if(path.isEmpty())
- path = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + "/smolbote/smolbote.cfg";
-
- return path.toStdString();
-#endif
-}
-
-CommandLine::CommandLine(int argc, char **argv)
- : m_homePath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation).toStdString())
-{
- m_description.add_options()
- ("help,h", "Display command-line options list.")
- ("version,v", "Display version information.")
- ("build", "Display build commit.")
-
- ("config,c", po::value<std::string>()->default_value(defaultUserConfigLocation()), "Set the configuration file.")
- ("no-remote", "Do not accept or send remote commands.")
-
- ("session,s", po::value<std::string>(), "Open the selected session.")
- ("pick-session", "Show all available sessions and select which one to open.")
-
- ("args", po::value<std::vector<std::string>>(), "Command(s) and/or URL(s).")
- ;
-
- m_arguments.add("args", -1);
-
- try {
- auto cmd = po::command_line_parser(argc, argv);
- cmd.allow_unregistered();
- cmd.options(m_description);
- cmd.positional(m_arguments);
- po::store(cmd.run(), vm);
- } catch(const po::error &e) {
- qWarning("Error parsing cmd: %s", e.what());
- }
-}