[cig-commits] [commit] master, python-removal, rajesh-petsc-schur: Added a more detailed usage string (bb91e3a)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Wed Nov 5 19:03:35 PST 2014
Repository : https://github.com/geodynamics/citcoms
On branches: master,python-removal,rajesh-petsc-schur
Link : https://github.com/geodynamics/citcoms/compare/464e1b32299b15819f93efd98d969cddb84dfe51...f97ae655a50bdbd6dac1923a3471ee4dae178fbd
>---------------------------------------------------------------
commit bb91e3a65d094c953ac37ac24a901cadaf4bb9fc
Author: Rajesh Kommu <rajesh.kommu at gmail.com>
Date: Fri Sep 5 11:05:37 2014 -0700
Added a more detailed usage string
>---------------------------------------------------------------
bb91e3a65d094c953ac37ac24a901cadaf4bb9fc
Py2C/Py2CMain.cpp | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/Py2C/Py2CMain.cpp b/Py2C/Py2CMain.cpp
index 154c06d..b5d1d88 100644
--- a/Py2C/Py2CMain.cpp
+++ b/Py2C/Py2CMain.cpp
@@ -1,15 +1,25 @@
#include "Py2C.hpp"
+const char* usage = "Usage: Py2C infile outfile save_all\n\n"
+ "Where\n\n"
+ "infile is the name of Python version of the configuration file\n\n"
+ "outfile is the name of the C version of the configuration file\n\n"
+ "save_all=False means outfile will only have parameters that were set in infile\n\n"
+ "save_all=True means outfile will have all CitcomS parameters, grouped by the Python section names\n";
+
int main(int argc, char* argv[])
{
if( argc != 4)
{
- std::cerr << "Usage: Py2C infile outfile true|false" << std::endl;
+ std::cerr << usage << std::endl;
exit(-1);
}
Py2CConverter py2c(argv[1], argv[2]);
- bool save_all = (std::string(argv[3])=="true"?true:false);
- py2c.convert(save_all);
+ std::string saveallstr(argv[3]);
+ std::transform(saveallstr.begin(), saveallstr.end(), saveallstr.begin(), ::tolower);
+
+ bool saveall = ((saveallstr == "true") ? true : false);
+ py2c.convert(saveall);
}
More information about the CIG-COMMITS
mailing list