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

Command for saving (committing) staged changes to the repository. More...

#include <SaveCommand.hxx>

Inheritance diagram for svcs::cli::SaveCommand:
svcs::cli::ICommand

Public Member Functions

 SaveCommand (std::shared_ptr< ISubject > subject, std::shared_ptr< RepositoryManager > repoManager)
 Constructs the SaveCommand.
bool execute (const std::vector< std::string > &args) override
 Executes the save command.
std::string getName () const override
 Gets the name of the command.
std::string getDescription () const override
 Gets the description of the command.
std::string getUsage () const override
 Gets the usage syntax of the command.
void showHelp () const override
 Shows detailed help information for this command.
Public Member Functions inherited from svcs::cli::ICommand
virtual ~ICommand ()=default
 Virtual destructor.

Detailed Description

Command for saving (committing) staged changes to the repository.

The SaveCommand creates a permanent snapshot of all staged changes with a descriptive message.

Constructor & Destructor Documentation

◆ SaveCommand()

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

Constructs the SaveCommand.

Parameters
subjectShared pointer to the event bus for notifications.
repoManagerShared pointer to the repository manager.

Member Function Documentation

◆ execute()

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

Executes the save command.

Parameters
argsCommand arguments. Expected format: ["-m", "message"] or ["--message", "message"]
Returns
true if save succeeded, false otherwise.

Implements svcs::cli::ICommand.

◆ getDescription()

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

Gets the description of the command.

Returns
"Save staged changes to the repository"

Implements svcs::cli::ICommand.

◆ getName()

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

Gets the name of the command.

Returns
"save"

Implements svcs::cli::ICommand.

◆ getUsage()

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

Gets the usage syntax of the command.

Returns
"svcs save -m \"message\""

Implements svcs::cli::ICommand.

◆ showHelp()

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

Shows detailed help information for this command.

Implements svcs::cli::ICommand.


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