wex v24.04.0
Public Types | Public Member Functions | List of all members
wex::vcs_entry Class Reference

This class collects a single vcs. More...

#include <wex/vcs/vcs-entry.h>

Inheritance diagram for wex::vcs_entry:
Inheritance graph
[legend]

Public Types

enum class  flags_location_t { }
 Flags location flags, indicate where flags from xml should be placed when building vcs commands. More...
 

Public Member Functions

 vcs_entry (const pugi::xml_node &node=pugi::xml_node())
 Default constructor using xml node.
 
int system (const process_data &data) override
 Executes the command synchronously.
 
const auto & admin_dir () const
 Returns the administrative directory.
 
size_t build_menu (int base_id, menu *menu) const
 Builds a menu from all vcs commands.
 
bool execute (const std::string &args=std::string(), const lexer &lexer=wex::lexer(), const std::string &wd=std::string())
 Executes the current vcs command synchronously (from set_command), or the first command if set_command was not yet invoked.
 
auto flags_location () const
 Returns flags location.
 
const blameget_blame () const
 Returns blame info.
 
blameget_blame ()
 Returns blame info.
 
const std::string get_branch (const std::string &wd=std::string()) const
 Returns the name of current branch.
 
const std::string get_flags () const
 Returns the flags used to run the command.
 
bool log (const path &p, const std::string &id)
 Executes the log command using the log id to be retrieved.
 
void show_output (const std::string &caption=std::string()) const override
 Shows stdout or stderr from system on the shell component.
 
- Public Member Functions inherited from wex::process
 process ()
 Default constructor.
 
bool async_system (const process_data &data) override
 Override methods.
 
bool write (const std::string &text) override
 Writes text to stdin of process.
 
auto * get_frame ()
 Returns the frame.
 
- Public Member Functions inherited from wex::factory::process
 process ()
 Default constructor.
 
virtual ~process ()
 Destructor, stops running process.
 
void async_sleep_for (const std::chrono::milliseconds &ms)
 Sleeps for some milliseconds time.
 
const process_datadata () const
 Returns last or current data used by async_system or system.
 
bool is_debug () const
 Is this a debug process.
 
bool is_running () const
 Is this process running.
 
void set_handler_dbg (wxEvtHandler *eh)
 Sets debug event handler.
 
void set_handler_out (wxEvtHandler *eh)
 Sets out event handler.
 
const auto & std_err () const
 Returns the stderr.
 
const auto & std_out () const
 Returns the stdout.
 
- Public Member Functions inherited from wex::menu_commands< vcs_command >
 menu_commands (const std::string &name=std::string(), const std::vector< vcs_command > &commands={})
 Default constructor.
 
 menu_commands (const pugi::xml_node &node)
 Constructor using xml node.
 
const vcs_command find (const std::string &name) const
 Returns the menu command equal to name specified.
 
const auto & flags_key () const
 Returns the flags key.
 
const auto get_command () const
 Returns the current command.
 
const auto & get_commands () const
 Returns all the commands.
 
const auto & name () const
 Returns the name for this group of commands.
 
bool set_command (int command_no)
 Sets the current command.
 

Additional Inherited Members

- Static Public Member Functions inherited from wex::process
static int config_dialog (const data::window &data=data::window())
 Shows a config dialog, allowing you to set the command and folder.
 
static auto * get_shell ()
 Returns the shell component (might be nullptr if prepare_output is not yet invoked).
 
static shellprepare_output (wxWindow *parent)
 Construct the shell component, and returns it.
 

Detailed Description

This class collects a single vcs.

Member Enumeration Documentation

◆ flags_location_t

Flags location flags, indicate where flags from xml should be placed when building vcs commands.

Enumerator
PREFIX 

after e.g. id

before e.g. id

Member Function Documentation

◆ build_menu()

size_t wex::vcs_entry::build_menu ( int base_id,
menu * menu ) const

Builds a menu from all vcs commands.

Returns (total) number of items in menu.

Parameters
base_idmenu id to be added to the vcs commands
menumenu to be built

◆ execute()

bool wex::vcs_entry::execute ( const std::string & args = std::string(),
const lexer & lexer = wex::lexer(),
const std::string & wd = std::string() )

Executes the current vcs command synchronously (from set_command), or the first command if set_command was not yet invoked.

Might ask for vcs binary if it is not yet known. Return code is code from process execute, and also can be false if dialog for vcs bin was cancelled.

Parameters
argsargs, like filenames, or vcs flags
lexerlexer that is used for presenting the output
wdworking directory

◆ log()

bool wex::vcs_entry::log ( const path & p,
const std::string & id )

Executes the log command using the log id to be retrieved.

Return value is false if process could not execute.

Parameters
ppath to be used
idid to be retrieved

◆ show_output()

void wex::vcs_entry::show_output ( const std::string & caption = std::string()) const
overridevirtual

Shows stdout or stderr from system on the shell component.

You can override this method to e.g. prepare a lexer on get_shell before calling this base method.

Reimplemented from wex::process.

◆ system()

int wex::vcs_entry::system ( const process_data & data)
overridevirtual

Executes the command synchronously.

You just need to specify the flags, the binary itself is prefixed by wex. Flags available from git menu commands xml are also added. Return value is the process exit code.

Reimplemented from wex::process.