www.cemf.ir
commandLine.cpp
Go to the documentation of this file.
1 /*------------------------------- phasicFlow ---------------------------------
2  O C enter of
3  O O E ngineering and
4  O O M ultiscale modeling of
5  OOOOOOO F luid flow
6 ------------------------------------------------------------------------------
7  Copyright (C): www.cemf.ir
8  email: hamid.r.norouzi AT gmail.com
9 ------------------------------------------------------------------------------
10 Licence:
11  This file is part of phasicFlow code. It is a free software for simulating
12  granular and multiphase flows. You can redistribute it and/or modify it under
13  the terms of GNU General Public License v3 or any other later versions.
14 
15  phasicFlow is distributed to help others in their research in the field of
16  granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
17  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 
19 -----------------------------------------------------------------------------*/
20 
21 #include "commandLine.hpp"
22 
23 
25 :
26  CLI::App(description),
27  appName_(appName)
28 {
29  CLI::App::set_help_flag("-h,--help", "Help for using "+appName_+ " of "+versionName);
30  CLI::App::set_version_flag("-v,--version", versionName, "Program version information");
31 }
32 
34 :
35  commandLine(appName)
36 {
37 
38  CLI::App::add_flag_callback(
39  "--description",
40  [disptn, appName]() {
43  mOutput<<"Description for "<< Bold_Text(appName)<<":\n";
44  mOutput<<" "<<disptn<<endl;
45  },
46  "What does this app do?"
47  )->configurable(false);
48 }
49 
51  int argc,
52  char** argv)
53 {
54  try {
55  CLI::App::parse(argc, argv);
56  if(CLI::App::count("--description")) return false;
57  return true;
58  } catch(const ParseError &e) {
59  CLI::App::exit(e);
60  return false;
61  }
62 
63  //if()
64 }
count
auto count(const Vector< T, Allocator > &vec, const T &val)
pFlow::mOutput
masterOstream mOutput
pFlow::commandLine::appName_
word appName_
Definition: commandLine.hpp:50
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::commandLine
Definition: commandLine.hpp:36
pFlow::endl
iOstream & endl(iOstream &os)
Add newline and flush stream.
Definition: iOstream.hpp:341
Yellow_Text
#define Yellow_Text(text)
Definition: iOstream.hpp:40
pFlow::commandLine::parse
bool parse(int argc, char **argv)
Definition: commandLine.cpp:50
pFlow::commandLine::versoinCopyright
static word versoinCopyright
Definition: commandLine.hpp:62
pFlow::commandLine::commandLine
commandLine(word appName)
Definition: commandLine.cpp:24
pFlow::commandLine::versionName
static word versionName
Definition: commandLine.hpp:60
pFlow::commandLine::ParseError
CLI::ParseError ParseError
Definition: commandLine.hpp:44
Bold_Text
#define Bold_Text(text)
Definition: iOstream.hpp:45
pFlow::floatingPointDescription
word floatingPointDescription()
Definition: builtinTypes.hpp:69
commandLine.hpp