SVCS - English Documentation
Loading...
Searching...
No Matches
svcs::cli::AddCommand Class Reference

Implements the "add" command for the Simple Version Control System (SVCS). More...

#include <AddCommand.hxx>

Inheritance diagram for svcs::cli::AddCommand:
svcs::cli::ICommand

Public Member Functions

 AddCommand (std::shared_ptr< ISubject > subject, std::shared_ptr< RepositoryManager > repoManager)
 Constructor for AddCommand.
bool execute (const std::vector< std::string > &args) override
 Executes the "add" command with the given arguments.
std::vector< std::string > getAllFilesInDirectory (const std::string &directory) const
 Retrieves all file paths within a given directory, recursively.
std::string getName () const override
 Gets the name of the command.
std::string getDescription () const override
 Gets a brief description of the command.
std::string getUsage () const override
 Gets the command's usage syntax.
void showHelp () const override
 Displays the detailed help information for the command.
Public Member Functions inherited from svcs::cli::ICommand
virtual ~ICommand ()=default
 Virtual destructor.

Detailed Description

Implements the "add" command for the Simple Version Control System (SVCS).

This command is responsible for adding (staging) the specified files to the staging area of the repository for a subsequent commit. The class inherits from ICommand and uses the Command pattern to execute its operations. It depends on ISubject (event bus) for user notifications and RepositoryManager for repository operations.

Constructor & Destructor Documentation

◆ AddCommand()

svcs::cli::AddCommand::AddCommand ( std::shared_ptr< ISubject > subject,
std::shared_ptr< RepositoryManager > repoManager )

Constructor for AddCommand.

Parameters
subjectA shared pointer to the ISubject (event bus).
repoManagerA shared pointer to the RepositoryManager.

Member Function Documentation

◆ execute()

bool svcs::cli::AddCommand::execute ( const std::vector< std::string > & args)
overridevirtual

Executes the "add" command with the given arguments.

Parameters
argsThe vector of string arguments for the command.
Returns
true if the command executed successfully, false otherwise.

Implements svcs::cli::ICommand.

◆ getAllFilesInDirectory()

std::vector< std::string > svcs::cli::AddCommand::getAllFilesInDirectory ( const std::string & directory) const
nodiscard

Retrieves all file paths within a given directory, recursively.

Parameters
directoryThe path to the directory.
Returns
A vector of strings containing all file paths.

◆ getDescription()

std::string svcs::cli::AddCommand::getDescription ( ) const
nodiscardoverridevirtual

Gets a brief description of the command.

Returns
A string describing the command's purpose.

Implements svcs::cli::ICommand.

◆ getName()

std::string svcs::cli::AddCommand::getName ( ) const
inlinenodiscardoverridevirtual

Gets the name of the command.

Returns
The command name, "add".

Implements svcs::cli::ICommand.

◆ getUsage()

std::string svcs::cli::AddCommand::getUsage ( ) const
nodiscardoverridevirtual

Gets the command's usage syntax.

Returns
A string showing how to use the command.

Implements svcs::cli::ICommand.

◆ showHelp()

void svcs::cli::AddCommand::showHelp ( ) const
overridevirtual

Displays the detailed help information for the command.

Implements svcs::cli::ICommand.


The documentation for this class was generated from the following files: