fibercrypto / fibercrypto/fibercryptowallet
Command-line support
- Dominant language
- Go
- Stars
- 29
- Forks
- 15
- PR merge metrics
- No merged PRs in 30d
Description
**Feature description**
Everything that can be done with the GUI must be also possible to do without a GUI.
**Describe the feature**
Allow using the *FiberCrypto Wallet* from a terminal using command-line options. For that, the Qt types `QCommandLineOption` and `QCommandLineParser` must be used. Every feature must be represented with a `QCommandLineOption`.
**Is your feature request related to a problem? Please describe.**
It's not possible to use the application in display-less devices like servers. Having command-line options is always beneficial.
**Describe the solution you'd like**
Command line options to create/load wallets, sign wallets, create transactions, etc...
**Additional context**
Qt types `QCommandLineOption` and `QCommandLineParser` are very useful.
There is a C++ example:
```c++
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
QCoreApplication::setApplicationName("my-copy-program");
QCoreApplication::setApplicationVersion("1.0");
QCommandLineParser parser;
parser.setApplicationDescription("Test helper");
parser.addHelpOption();
parser.addVersionOption();
parser.addPositionalArgument("source", QCoreApplication::translate("main", "Source file to copy."));
parser.addPositionalArgument("destination", QCoreApplication::translate("main", "Destination directory."));
// A boolean option with a single name (-p)
QCommandLineOption showProgressOption("p", QCoreApplication::translate("main", "Show progress during copy"));
parser.addOption(showProgressOption);
// A boolean option with multiple names (-f, --force)
QCommandLineOption forceOption(QStringList() << "f" << "force",
QCoreApplication::translate("main", "Overwrite existing files."));
parser.addOption(forceOption);
// An option with a value
QCommandLineOption targetDirectoryOption(QStringList() << "t" << "target-directory",
QCoreApplication::translate("main", "Copy all source files into ."),
QCoreApplication::translate("main", "directory"));
parser.addOption(targetDirectoryOption);
// Process the actual command line arguments given by the user
parser.process(app);
const QStringList args = parser.positionalArguments();
// source is args.at(0), destination is args.at(1)
bool showProgress = parser.isSet(showProgressOption);
bool force = parser.isSet(forceOption);
QString targetDir = parser.value(targetDirectoryOption);
// ...
}
```
**Possible implementation**
- [ ] Instantiate a `QCommandLineParser` and setup it by adding **Help** and **Version** options.
- [ ] Create a `QCommandLineOption` for every feature.
- [ ] Parse command line options by calling `QCommandLineParser::process(const QCoreApplication&)`
- [ ] Check for arguments and options by using `QCommandLineParser::isSet(const QCommandLineOption&)` and execute the respective features.
Contributor guide
Assessment
This issue has not been assessed yet.