13 namespace fs = std::filesystem;
28 using MaCh3ArgumentParser::MaCh3ArgumentParser;
66 bool write_file(
const fs::path& path, std::string_view content)
const;
80 local cur prev words cword
81 _init_completion || return
82 COMPREPLY=( $(mach3 --complete "$cur" "${words[@]:1:$cword}") )
84 complete -F _mach3_complete mach3
90 local cur="$words[-1]"
91 completions=("${(@f)$(mach3 --complete "$cur" "${words[@]:1}")}")
92 compadd -a completions
Wrapper class for dynamically loaded plugins.
Interface for MaCh3 plugins and modules.
Extended ArgumentParser with MaCh3-specific functionality.
Main program class that manages modules, plugins, and command-line parsing.
void add_core_module(IModule &module)
Add a core module to the program.
virtual ~MaCh3Program()
Destructor that unloads all dynamic plugins.
void unload_dynamic_plugins()
Unload all dynamically loaded plugins.
bool write_file(const fs::path &path, std::string_view content) const
Write content to a file, creating parent directories if needed.
static constexpr std::string_view ZSH_COMPLETION
std::vector< std::string > m_subcommands
List of registered subcommand names.
void install_completions() const
Install shell completion scripts for bash and zsh.
static constexpr std::string_view BASH_COMPLETION
int Run()
Run the selected subcommand.
std::map< const MaCh3ArgumentParser *, IModule * > m_module_map
Map of parsers to core modules (non-owning)
void completions(const std::string &prefix) const
Generate completion suggestions for the given prefix.
std::map< const MaCh3ArgumentParser *, std::unique_ptr< DynamicPlugin > > m_dynamic_plugin_map
Map of parsers to dynamic plugins (owning)
std::string detect_shell() const
Detect the user's shell from the SHELL environment variable.
void load_dynamic_plugins()
Load dynamic plugins from the MACH3_PLUGINS environment variable.
std::vector< std::string > expand_plugin_path(const std::string &path) const
Expand a plugin path (file or directory) into a list of .so files.
Main namespace for MaCh3 software.
Plugin interface and registration macros for MaCh3.