MaCh3  2.6.1
Reference Guide
mach3.cpp
Go to the documentation of this file.
1 
10 #include "CLI/MaCh3Program.hpp"
11 
20 int main(int argc, char *argv[]) {
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 }
Module for MCMC diagnostic analysis.
Module for extracting penalty terms from systematic chains.
#define MACH3LOG_ERROR
Definition: MaCh3Logger.h:37
Core program class for the MaCh3 command-line interface.
Module for processing MCMC chains and producing diagnostic plots.
Module for performing diagnostic analysis on MCMC chains.
Module for extracting specific penalty terms from MCMC chains.
const MaCh3ArgumentParser & get_subcommand_used() const
Get the subcommand that was used in parsing.
Definition: m3argparse.hpp:40
Main program class that manages modules, plugins, and command-line parsing.
void add_core_module(IModule &module)
Add a core module to the program.
int Run()
Run the selected subcommand.
void load_dynamic_plugins()
Load dynamic plugins from the MACH3_PLUGINS environment variable.
Module for processing MCMC chains and producing various diagnostic plots.
int main(int argc, char *argv[])
Main entry point for the MaCh3 application.
Definition: mach3.cpp:20