4 #include "completer_functions.hh"
9 using namespace Completer;
18 case ARG_TYPE::COMMAND:
20 case ARG_TYPE::SCELNAME:
24 case ARG_TYPE::OPERATOR:
44 Suboption sub0(
"--void",
"-v", ARG_TYPE::VOID);
46 std::cout << sub0.
long_tag() << std::endl;
47 std::cout << sub0.
short_tag() << std::endl;
53 Suboption sub0(
"--void",
"-v", ARG_TYPE::VOID);
54 Suboption sub1(
"--path",
"-p", ARG_TYPE::PATH);
55 Suboption sub2(
"--command",
"-c", ARG_TYPE::COMMAND);
56 Suboption sub3(
"--scel",
"-s", ARG_TYPE::SCELNAME);
57 Suboption sub4(
"--query",
"-q", ARG_TYPE::QUERY);
58 Suboption sub5(
"--operator",
"-o", ARG_TYPE::OPERATOR);
60 std::vector<Suboption> subopts;
61 subopts.push_back(sub0);
62 subopts.push_back(sub1);
63 subopts.push_back(sub2);
64 subopts.push_back(sub3);
65 subopts.push_back(sub4);
66 subopts.push_back(sub5);
68 Option opt(
"fake", subopts);
70 std::cout << opt.
tag() << std::endl;
74 std::cout << opt.
matches(
"fake") << opt.
matches(
"real") << std::endl;
81 std::vector<std::string> scellname_list, filter_expr;
83 po::options_description
desc(
"'casm enum' usage");
85 (
"help,h",
"Write help documentation")
86 (
"min", po::value<int>(&min_vol),
"Min volume")
87 (
"max", po::value<int>(&max_vol),
"Max volume")
88 (
"filter,f", po::value<std::vector<std::string> >(&filter_expr)->multitoken(),
"Filter configuration enumeration so that")
89 (
"scellname,n", po::value<std::vector<std::string> >(&scellname_list)->multitoken(),
"Enumerate configs for given supercells")
90 (
"all,a",
"Enumerate configurations for all supercells")
91 (
"supercells,s",
"Enumerate supercells")
92 (
"configs,c",
"Enumerate configurations");
97 std::cout << opt.
tag() << std::endl;
101 std::cout << opt.
matches(
"testopt") << opt.
matches(
"real") << std::endl;
107 int min_vol, max_vol;
108 std::vector<std::string> scellname_list, filter_expr;
110 po::options_description
desc(
"'casm enum' usage");
112 (
"help,h",
"Write help documentation")
113 (
"min", po::value<int>(&min_vol),
"Min volume")
114 (
"max", po::value<int>(&max_vol),
"Max volume")
115 (
"filter,f", po::value<std::vector<std::string> >(&filter_expr)->multitoken(),
"Filter configuration enumeration so that")
116 (
"scellname,n", po::value<std::vector<std::string> >(&scellname_list)->multitoken(),
"Enumerate configs for given supercells")
117 (
"all,a",
"Enumerate configurations for all supercells")
118 (
"supercells,s",
"Enumerate supercells")
119 (
"configs,c",
"Enumerate configurations");
121 po::option_description testop(
"filter,x", po::value<int>(&min_vol)->default_value(5)->value_name(
"lol"),
"Filter configuration enumeration so that");
123 std::cout <<
"FORMAT:" << std::endl;
124 std::cout << testop.format_parameter() << std::endl;
126 std::cout << testop.canonical_display_name(po::command_line_style::allow_dash_for_short) << std::endl;
127 std::cout << testop.canonical_display_name(po::command_line_style::allow_long) << std::endl;
129 for(
auto it =
desc.options().begin(); it !=
desc.options().end(); ++it) {
130 std::cout << (*it)->canonical_display_name(po::command_line_style::allow_dash_for_short) <<
" ";
131 std::cout << (*it)->canonical_display_name(po::command_line_style::allow_long) << std::endl;
140 po::options_description
desc(
"phony target " + postfix);
143 (((
"aaaa" + postfix +
",") + std::string(1,
char(beginshort + 1))).c_str(),
145 (
"aaaa" + postfix +
" info").c_str())
147 (((
"bbbb" + postfix +
",") + std::string(1,
char(beginshort + 2))).c_str(),
149 (
"bbbb" + postfix +
" info").c_str())
151 (((
"cccc" + postfix +
",") + std::string(1,
char(beginshort + 3))).c_str(),
153 (
"cccc" + postfix +
" info").c_str())
155 (((
"dddd" + postfix +
",") + std::string(1,
char(beginshort + 4))).c_str(),
156 po::value<int>(&phony),
157 (
"dddd" + postfix +
" info").c_str())
159 (((
"eeee" + postfix +
",") + std::string(1,
char(beginshort + 5))).c_str(),
160 po::value<int>(&phony),
161 (
"eeee" + postfix +
" info").c_str());
189 std::string test =
"asdf";
190 po::option_description testop
193 "Filter configuration enumeration so that");
196 std::cout <<
"DETERMINED: " <<
recast(determined_type) << std::endl;
204 for(
auto it = dict.
begin(); it != dict.
cend(); ++it) {
206 std::cout << it->name() <<
" ";
209 std::cout << std::endl;
215 using namespace CASM;
217 int main(
int argc,
char *argv[]) {
static std::string path()
Get value_type string for path completion.
static ARG_TYPE determine_type(const po::option_description &boost_option)
static std::string operation()
Get value_type string for operation completion.
static std::string query()
Get value_type string for query completion.
static std::string supercell()
Get value_type string for supercell completion.
std::vector< std::string > probe_options() const
Get a list of all available options.
std::vector< std::string > probe_suboptions(const std::string &option_tag) const
For a particular option, get the available suboptions.
void push_back(const Option &new_option)
Append a new option to the engine.
ARG_TYPE probe_argument_type(const std::string &suboption_tag) const
std::string tag() const
Return the identifying name of *this (e.g. "super", "monte", etc)
bool matches(const std::string &test_tag) const
Check if the given string corresponds to the tag of *this.
std::vector< std::string > probe_suboptions() const
Return what the suboptions (–long format) for *this are.
std::string short_tag() const
Return short name as char.
ARG_TYPE argument_type() const
Return the expected types of arguments that follow *this.
bool matches(const std::string &test_tag) const
std::string long_tag() const
Return long name in string format.
const_iterator cend() const
int main(int argc, char *argv[])
ArgHandler::ARG_TYPE ARG_TYPE
Option generate_option(std::string postfix, char beginshort)
std::string recast(ARG_TYPE atype)