Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add a new command for cli in fedora #3632

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions src/cli/commandargumentt.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#include "commandargument.h"
#include <utility>

/**
* @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;
}