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
24
pFlow::commandLine::commandLine
(
word
appName)
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
33
pFlow::commandLine::commandLine
(
word
appName,
word
disptn)
34
:
35
commandLine
(appName)
36
{
37
38
CLI::App::add_flag_callback(
39
"--description"
,
40
[disptn, appName]() {
41
output
<<
"\n"
<<
yellowText
(
versoinCopyright
)<<
endl
;
42
output
<<
yellowText
(
floatingPointDescription
())<<
endl
<<
endl
;
43
output
<<
"Description for "
<<
boldText
(appName)<<
":\n"
;
44
output
<<
" "
<<disptn<<
endl
;
45
},
46
"What does this app do?"
47
)->configurable(
false
);
48
}
49
50
bool
pFlow::commandLine::parse
(
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::commandLine::appName_
word appName_
Definition:
commandLine.hpp:50
pFlow::word
std::string word
Definition:
builtinTypes.hpp:63
pFlow::commandLine
Definition:
commandLine.hpp:36
pFlow::endl
iOstream & endl(iOstream &os)
Add newline and flush stream.
Definition:
iOstream.hpp:320
pFlow::commandLine::parse
bool parse(int argc, char **argv)
Definition:
commandLine.cpp:50
pFlow::commandLine::versoinCopyright
static word versoinCopyright
Definition:
commandLine.hpp:62
pFlow::output
Ostream output
pFlow::commandLine::commandLine
commandLine(word appName)
Definition:
commandLine.cpp:24
boldText
#define boldText(text)
Definition:
streams.hpp:35
pFlow::commandLine::versionName
static word versionName
Definition:
commandLine.hpp:60
pFlow::floatingPointDescription
auto floatingPointDescription()
Definition:
builtinTypes.hpp:66
pFlow::commandLine::ParseError
CLI::ParseError ParseError
Definition:
commandLine.hpp:44
yellowText
#define yellowText(text)
Definition:
streams.hpp:30
commandLine.hpp
src
phasicFlow
commandLine
commandLine.cpp
Generated by
1.8.17