28 po::value<std::vector<fs::path> >(&
m_pos_vec)
31 "Path(s) to structure(s) being imported (multiple allowed, but no "
32 "wild-card matching)")
36 "Path to batch file, which should list one structure file path per "
38 "(can be used in combination with --pos)")
41 "Attempt to extract calculation data from the enclosing "
42 "directory of the structure files, if it is available")
44 (
"copy-additional-files",
45 "Recursively copy other files from the same directory as "
46 "the properties.calc.json file.");
50 bool required =
false;
67 virtual int help()
const;
69 virtual int desc()
const;
71 virtual int run()
const;
89 log() <<
"Import structures or calculation data specified by --pos or "
92 "Structures are mapped to the closest matching configuration "
94 "with the primitive crystal structure. If a JSON file is specified, "
96 "will be interpreted as a 'properties.calc.json' file.\n\n"
98 "For complete import options description for a particular config "
100 "--desc along with '--type <typename>'.\n\n";
106 err_log() <<
"ERROR: No --type\n";
119 template <
typename DataObject>
124 int help()
const override;
126 int desc()
const override;
128 int run()
const override;
131 template <
typename DataObject>
135 << m_cmd.opt().desc() <<
"\n\n"
137 <<
"For complete options description for a particular config type, use:\n"
144 template <
typename DataObject>
150 template <
typename DataObject>
168 err_log() <<
"Error in 'casm import'. "
169 "Use --pos or --batch to specify structures to be imported"
186 if (!
opt().configtype_opts().
count(
opt().configtype())) {
187 std::stringstream msg;
188 msg <<
"--type " <<
opt().
configtype() <<
" is not allowed for 'casm "
197 m_impl = notstd::make_unique<ImportCommandImplBase>(*
this);
204 sout <<
"The allowed types are:\n";
206 for (
const auto &configtype :
opt().configtype_opts()) {
207 sout <<
" " << configtype << std::endl;
212 if (
count(
"settings")) {
214 }
else if (
count(
"input")) {
const OptionType & opt() const
const po::variables_map & vm() const
int count(std::string s) const
static std::string path()
Get value_type string for path completion.
std::string configtype() const
const std::vector< fs::path > & pos_vec() const
std::vector< fs::path > m_pos_vec
const fs::path & batch_path() const
void initialize() override
Fill in the options descriptions accordingly.
const fs::path settings_path() const
Returns the path corresponding to add_settings_suboption.
void add_input_suboption(bool required=true)
const po::options_description & desc()
Get the program options, filled with the initialized values.
void add_settings_suboption(bool required=true)
void add_help_suboption()
Add a plain –help and –desc suboptions.
po::options_description m_desc
void add_configtype_suboption(std::string _default, std::set< std::string > _configtype_opts)
Add –type suboption (default, set of short_name of allowed ConfigTypes)
std::unique_ptr< ImportCommandImplBase > m_impl
void print_names(std::ostream &sout) const
static const std::string name
ImportCommandImplBase & impl() const
int desc() const override
ImportCommand(const CommandArgs &_args, Completer::ImportOption &_opt)
int vm_count_check() const override
int help() const override
Defaults used if DataObject type doesn't matter or not given.
const ImportCommand & m_cmd
ImportCommandImplBase(const ImportCommand &cmd)
virtual ~ImportCommandImplBase()
ImportCommandImpl(const ImportCommand &cmd)
int desc() const override
int help() const override
static jsonParser parse(const std::string &str)
Construct a jsonParser from a string containing JSON data.
void for_config_type_short(std::string short_name, F f)
const std::set< std::string > & config_types_short()
std::set of all QueryTraits<ConfigType>::short_name
Data structure holding basic CASM command info.