New command line parser
A new, more flexible and restrictive parser to improve the usage and experience of Flameshot in the command line. This parser is based on a parent-child node model and is very easy to define relationships between arguments and options with informative error checking. You can define lambdas to check the received values for every option and custom error messages
This commit is contained in:
45
src/cli/commandargument.h
Normal file
45
src/cli/commandargument.h
Normal file
@@ -0,0 +1,45 @@
|
||||
// Copyright 2017 Alejandro Sirgo Rica
|
||||
//
|
||||
// This file is part of Flameshot.
|
||||
//
|
||||
// Flameshot is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Flameshot is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Flameshot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef COMMANDARGUMENT_H
|
||||
#define COMMANDARGUMENT_H
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
class CommandArgument
|
||||
{
|
||||
public:
|
||||
CommandArgument();
|
||||
explicit CommandArgument(const QString &name, const QString &description);
|
||||
|
||||
void setName(const QString &name);
|
||||
QString name() const;
|
||||
|
||||
void setDescription(const QString &description);
|
||||
QString description() const;
|
||||
|
||||
bool isRoot() const;
|
||||
|
||||
bool operator ==(const CommandArgument &arg) const;
|
||||
|
||||
private:
|
||||
QString m_name;
|
||||
QString m_description;
|
||||
|
||||
};
|
||||
|
||||
#endif // COMMANDARGUMENT_H
|
||||
Reference in New Issue
Block a user