From e35fa4c0031d37b66dfd8226829c86ef73f8ccc5 Mon Sep 17 00:00:00 2001 From: castroofelipee Date: Tue, 11 Jun 2024 12:20:11 -0300 Subject: [PATCH] feat: add a new command for cli in fedora --- src/cli/commandargumentt.cpp | 63 ++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/cli/commandargumentt.cpp diff --git a/src/cli/commandargumentt.cpp b/src/cli/commandargumentt.cpp new file mode 100644 index 0000000000..6b4a51bf7e --- /dev/null +++ b/src/cli/commandargumentt.cpp @@ -0,0 +1,63 @@ +#include "commandargument.h" +#include + +/** + * @class CommandArgument + * @brief A class that represents a command line argument with a name and description. + */ + +class CommandArgument { +public: + CommandArgument(); + CommandArgument(QString name, 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; +}; + +CommandArgument::CommandArgument() = default; + +CommandArgument::CommandArgument(QString name, QString description) + : m_name(std::move(name)) + , m_description(std::move(description)) +{} + +void CommandArgument::setName(const QString& name) +{ + m_name = name; +} + +QString CommandArgument::name() const +{ + return m_name; +} + +void CommandArgument::setDescription(const QString& description) +{ + m_description = description; +} + +QString CommandArgument::description() const +{ + return m_description; +} + +bool CommandArgument::isRoot() const +{ + return m_name.isEmpty() && m_description.isEmpty(); +} + +bool CommandArgument::operator==(const CommandArgument& arg) const +{ + return m_description == arg.m_description && m_name == arg.m_name; +}