MaCh3  2.6.1
Reference Guide
Functions
mach3.cpp File Reference

Main entry point for the MaCh3 command-line interface. More...

#include "CLI/Modules/ProcessMCMCModule.hpp"
#include "CLI/Modules/DiagMCMCModule.hpp"
#include "CLI/Modules/GetPenaltyTermModule.hpp"
#include "CLI/MaCh3Program.hpp"
Include dependency graph for mach3.cpp:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 Main entry point for the MaCh3 application. More...
 

Detailed Description

Main entry point for the MaCh3 command-line interface.

This file contains the main function that initializes the MaCh3 program, registers core modules, loads dynamic plugins, and processes command-line arguments.

Definition in file mach3.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Main entry point for the MaCh3 application.

Initializes the MaCh3 program with core modules and dynamic plugins, parses command-line arguments, and executes the selected subcommand.

Parameters
argcNumber of command-line arguments
argvArray of command-line argument strings
Returns
Exit code (0 on success, non-zero on error)

Definition at line 20 of file mach3.cpp.

20  {
21  M3::MaCh3Program program("mach3");
22 
23  // // Hidden completion option
24  // program.add_argument("--complete")
25  // .hidden()
26  // .nargs(1);
27 
28  // // Hidden installer option
29  // program.add_argument("--install-completions")
30  // .help("")
31  // .flag();
32 
34  M3::DiagMCMCModule diag;
36 
37  program.add_core_module(proc);
38  program.add_core_module(diag);
39  program.add_core_module(penterm);
40  program.load_dynamic_plugins();
41 
42  try {
43  program.parse_args(argc, argv);
44  }
45  catch (const std::exception& err) {
46  // // completions count as parsing error
47  // if (auto prefix = program.present<std::string>("--complete")) {
48  // program.completions(*prefix);
49  // return 0;
50  // }
51 
52  std::cerr << err.what() << std::endl;
53  std::cerr << program.get_subcommand_used();
54  MACH3LOG_ERROR(err.what());
55  return 1;
56  }
57  catch(...){
58  MACH3LOG_ERROR("Unknown parsing error.");
59  return 1;
60  }
61 
62  // no subcommand args
63  if (!program.get_subcommand_used()){
64  std::cerr << program.get_subcommand_used();
65  return 2;
66  }
67 
68 
69  // if (program.get<bool>("--install-completions")) {
70  // program.install_completions();
71  // return 0;
72  // }
73 
74  try{
75  program.Run();
76  }
77  catch(...){
78  return 3;
79  }
80 
81  return 0;
82 }
#define MACH3LOG_ERROR
Definition: MaCh3Logger.h:37
Module for performing diagnostic analysis on MCMC chains.
Module for extracting specific penalty terms from MCMC chains.
Main program class that manages modules, plugins, and command-line parsing.
Module for processing MCMC chains and producing various diagnostic plots.