31 cout <<
"\nfrePPLe v" <<
FreppleVersion() <<
" command line application\n"
33 " frepple [options] [files | directories]\n"
34 "\nThis program reads XML input data, and executes the modeling and\n"
35 "planning commands included in them.\n"
36 "The XML input can be provided in the following ways:\n"
37 " - Passing one or more XML files and/or directories as arguments.\n"
38 " When a directory is specified, the application will process\n"
39 " all files with the extension '.xml'.\n"
40 " - Passing one or more Python files with the extension '.py'\n"
41 " The Python commands are executed in the embedded interpreter.\n"
42 " - When passing no file or directory arguments, input will be read\n"
43 " from the standard input. XML data can be piped to the application.\n"
45 " -validate -v Validate the XML input for correctness.\n"
46 " -check -c Only validate the input, without executing the content.\n"
47 " -? -h -help Show these instructions.\n"
48 "\nEnvironment: The variable FREPPLE_HOME optionally points to a\n"
49 " directory where the initialization files init.xml, init.py,\n"
50 " frepple.xsd and module libraries will be searched.\n"
51 "\nReturn codes: 0 when successful, non-zero in case of errors\n"
52 "\nMore information on this program: http://www.frepple.com\n\n"
57 int main (
int argc,
char *argv[])
61 bool validate =
false;
62 bool validate_only =
false;
68 for (
int i = 1; i < argc; ++i)
70 if (argv[i][0] ==
'-')
73 if (!strcmp(argv[i],
"-validate") || !strcmp(argv[i],
"-v"))
75 else if (!strcmp(argv[i],
"-check") || !strcmp(argv[i],
"-c"))
79 if (strcmp(argv[i],
"-?")
80 && strcmp(argv[i],
"-h")
81 && strcmp(argv[i],
"-help"))
82 cout <<
"\nError: Option '" << argv[i]
83 <<
"' not recognized." << endl;
97 if (strlen(argv[i])>=3 && !strcmp(argv[i]+strlen(argv[i])-3,
".py"))
113 catch (
const exception& e)
116 ch <<
"Error: " << e.what();