SVCS - English Documentation
Loading...
Searching...
No Matches
svcs::test::cli::utils::InitCommand Class Reference

Implements the "init" command for the Version Control System (VCS). More...

#include <InitCommand.hxx>

Inheritance diagram for svcs::test::cli::utils::InitCommand:
svcs::cli::ICommand

Public Member Functions

 InitCommand (std::shared_ptr< ISubject > subject, std::shared_ptr< RepositoryManager > repoManager)
 Constructs an InitCommand.
bool execute (const std::vector< std::string > &args) override
 Executes the repository initialization logic.
std::string getName () const override
 Returns the command name.
std::string getDescription () const override
 Returns a brief description of the command's purpose.
std::string getUsage () const override
 Returns the usage syntax for the command.
void showHelp () const override
 Displays detailed help information about the command via the event bus.
Public Member Functions inherited from svcs::cli::ICommand
virtual ~ICommand ()=default
 Virtual destructor.

Detailed Description

Implements the "init" command for the Version Control System (VCS).

This command is responsible for initializing a new SVCS repository in the current directory or a specified location, setting up the necessary internal structure (e.g., the hidden .svcs directory). The class inherits from ICommand, ensuring it adheres to the Command pattern interface. It requires an event bus for communication and a repository manager to perform the actual initialization logic.

Constructor & Destructor Documentation

◆ InitCommand()

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

Constructs an InitCommand.

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

Member Function Documentation

◆ execute()

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

Executes the repository initialization logic.

This method attempts to create the repository structure.

Parameters
argsA vector of strings containing command-line arguments (usually empty for 'init').
Returns
true if the repository was successfully initialized or if it already exists, false if the initialization failed.

Implements svcs::cli::ICommand.

◆ getDescription()

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

Returns a brief description of the command's purpose.

Returns
A string containing the description.

Implements svcs::cli::ICommand.

◆ getName()

std::string svcs::cli::InitCommand::getName ( ) const
nodiscardoverridevirtual

Returns the command name.

Returns
The string "init".

Implements svcs::cli::ICommand.

◆ getUsage()

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

Returns the usage syntax for the command.

Returns
A string containing the usage: "svcs init".

Implements svcs::cli::ICommand.

◆ showHelp()

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

Displays detailed help information about the command via the event bus.

Implements svcs::cli::ICommand.


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