1 #ifndef CASM_APICommand_impl
2 #define CASM_APICommand_impl
12 template <
typename CommandType>
14 CommandArgs const &args,
typename CommandType::OptionType &opt) {
15 po::store(po::parse_command_line(args.
argc(), args.
argv(), opt.desc()),
18 return notstd::make_unique<CommandType>(args, opt);
26 template <
typename CommandType>
29 typename CommandType::OptionType &opt) {
35 return make_api_command<CommandType>(args, opt);
39 template <
typename CommandType>
41 typename CommandType::OptionType opt;
44 po::store(po::parse_command_line(args.
argc(), args.
argv(), opt.desc()),
50 CommandType f{args, opt};
55 if (f.vm().count(
"help")) {
59 else if (f.vm().count(
"desc")) {
64 code = f.vm_count_check();
73 }
catch (po::error &e) {
74 err_log() <<
"ERROR: " << e.what() << std::endl << std::endl;
77 err_log() <<
"ERROR: " << e.what() << std::endl << std::endl;
79 }
catch (std::exception &e) {
80 err_log() <<
"ERROR: " << e.what() << std::endl << std::endl;
fs::path root_dir() const
Return casm project directory path.
PrimClex is the top-level data structure for a CASM project.
const DirectoryStructure & dir() const
Access DirectoryStructure object. Throw if not set.
bool has_dir() const
Check if DirectoryStructure exists.
std::unique_ptr< CommandType > make_api_command(CommandArgs const &args, typename CommandType::OptionType &opt)
Parse command line options and make API command. Throws for parsing errors.
int run_api_command(const CommandArgs &args)
Standardizes how 'casm X' api commands are executed and implemented.
Data structure holding basic CASM command info.