23 bool required =
false;
28 "Print help message including a list of all available methods.")(
30 po::value<std::vector<std::string> >(&
m_desc_vec)
34 "Print extended usage description. "
35 "Use '--desc [MethodName [MethodName2...]]' for detailed method "
37 "Partial matches of method names are acceptable.");
51 "Method to use: Can use method name (including partial matches) or "
54 "Minimum volume supercell (integer, multiple of the prim volume)")(
56 "Maximum volume supercell (integer, multiple of the prim volume)")(
58 "Enumerate configurations for all existing supercells");
67 "Filter configuration enumeration so that only configurations matching a "
68 "'casm query'-type expression are recorded");
80 m_enumerator_vector(nullptr) {}
89 if (
vm().
count(
"method") != 1) {
90 err_log() <<
"Error in 'casm enum'. The --method option is required."
96 err_log() <<
"Error in 'casm enum'. The options --settings or --input may "
109 log() <<
"\nFor complete options description, use 'casm enum --desc "
116 if (
opt().desc_vec().size()) {
120 for (
const auto &in_name :
opt().desc_vec()) {
122 if (interface_ptr->name().substr(0, in_name.size()) == in_name) {
123 log() << interface_ptr->desc() << std::endl;
131 log() <<
"No match found. ";
140 log() <<
"DESCRIPTION\n" << std::endl;
142 log() <<
" casm enum --settings input.json "
144 " casm enum --input '{...JSON...}' "
146 " - Input settings in JSON format to run an enumeration. "
151 log() <<
"\nFor complete options help for a particular method, \n"
152 "use 'casm enum --desc MethodName'.\n\n";
154 log() <<
"Custom enumerator plugins can be added by placing source code \n"
155 "in the CASM project directory: \n"
176 auto enumeration_method_name_matches =
178 return interface_ptr->name().substr(0,
opt().
method().size()) ==
182 enumeration_method_name_matches);
186 enumeration_method_name_matches);
187 (*it)->run(
primclex(), json_options, cli_options_as_json);
189 }
else if (
count < 1) {
191 int method_index = -1;
193 method_index = stoi(
opt().method());
201 if (method_index < 0 || method_index >=
enumerators().size()) {
209 std::advance(it, method_index);
210 (*it)->run(
primclex(), json_options, cli_options_as_json);
212 }
else if (
count > 1) {
218 throw std::runtime_error(
"Unknown error in EnumCommand::run");
238 sout <<
"The enumeration methods are:\n";
241 sout <<
" " << counter <<
") " << interface_ptr->name() << std::endl;
PrimClex & primclex() const
const OptionType & opt() const
const po::variables_map & vm() const
int count(std::string s) const
static std::string enummethod()
Get value_type string for enummethod mode completion.
static std::string query()
Get value_type string for query completion.
void initialize() override
Fill in the options descriptions accordingly.
std::string method() const
std::vector< std::string > m_desc_vec
void add_input_suboption(bool required=true)
void add_confignames_suboption()
Add a –confignames suboption.
const po::options_description & desc()
Get the program options, filled with the initialized values.
void add_settings_suboption(bool required=true)
po::options_description m_desc
void add_dry_run_suboption(std::string msg=default_dry_run_msg())
void add_verbosity_suboption()
void add_scelnames_suboption()
Add a –scelnames suboption.
fs::path enumerator_plugins() const
Return enumerators plugin dir.
EnumInterfaceVector m_standard_enumerators
EnumInterfaceVector const & enumerators() const
EnumInterfaceVector const * m_enumerator_vector
int help() const override
EnumCommand(CommandArgs const &_args, Completer::EnumOption &_opt)
void print_names(std::ostream &sout, EnumInterfaceVector const &enumerators) const
int vm_count_check() const override
int desc() const override
static const std::string name
EnumInterfaceVector & get()
void error(const std::string &what)
EnumeratorHandler & enumerator_handler()
A 'cloneable_ptr' can be used in place of 'unique_ptr'.
ProjectSettings & settings()
const DirectoryStructure & dir() const
Access DirectoryStructure object. Throw if not set.
std::vector< notstd::cloneable_ptr< EnumInterfaceBase > > EnumInterfaceVector
jsonParser make_json_input(const OptionType &opt)
EnumInterfaceVector make_standard_enumerator_interfaces()
Data structure holding basic CASM command info.