45 "Usage: ht_wordstream [options] <words-per-record> [<word-file>]\n\n"
47 " This program is used to generate a stream of records, where each record\n"
48 " constists of one or more randomly chosen words concatenated together with\n"
49 " a ' ' character. The <words-per-record> argument controls how many words\n"
50 " each record should consist of, and the <word-file> argument can be used to\n"
51 " specify the file containing the source words, this argument defaults to\n"
52 " /usr/share/dict/words.\n\n"
56 static void init_options() {
58 (
"limit,l",
i64(),
"Limit on the number of records to output")
59 (
"seed,s",
i32()->default_value(1),
"Pseudo-random number generator seed")
62 (
"words-per-record",
i32(),
"Number of words for each output record.")
63 (
"word-file",
str()->default_value(
"/usr/share/dict/words"),
64 "Number of words for each output record.")
71 typedef Meta::list<MyPolicy, DefaultPolicy>
Policies;
73 int main(
int argc,
char **argv) {
75 init_with_policies<Policies>(argc, argv);
77 if (!
has(
"words-per-record")) {
79 quick_exit(EXIT_SUCCESS);
83 = make_shared<WordStream>(get_str(
"word-file"), 1, 2,
false);
86 cout << word_stream->next() <<
"\n";
90 quick_exit(EXIT_FAILURE);
94 quick_exit(EXIT_SUCCESS);
Interface and base of config policy.
A class generating a stream of words; the words are retrieved from a file and can be randomized...
Po::typed_value< String > * str(String *v=0)
Desc & cmdline_desc(const char *usage)
A macro which definds global functions like get_bool(), get_str(), get_i16() etc. ...
bool has(const String &name)
Check existence of a configuration value.
File system utility functions.
std::shared_ptr< WordStream > WordStreamPtr
Po::typed_value< int64_t > * i64(int64_t *v=0)
Po::typed_value< int32_t > * i32(int32_t *v=0)
Compatibility Macros for C/C++.
Initialization helper for applications.
Implementation of checksum routines.
Meta::list< MyPolicy, DefaultPolicy > Policies
This is a generic exception class for Hypertable.
int main(int argc, char **argv)
Desc & cmdline_hidden_desc()
Get the command line hidden options description (for positional options)
PositionalDesc & cmdline_positional_desc()
Get the command line positional options description.