[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [6127] Accept input files as command-line arguments
From: |
Greg Chicares |
Subject: |
[lmi-commits] [6127] Accept input files as command-line arguments |
Date: |
Mon, 09 Mar 2015 23:00:19 +0000 |
Revision: 6127
http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6127
Author: chicares
Date: 2015-03-09 23:00:18 +0000 (Mon, 09 Mar 2015)
Log Message:
-----------
Accept input files as command-line arguments
Modified Paths:
--------------
lmi/trunk/ChangeLog
lmi/trunk/skeleton.cpp
lmi/trunk/skeleton.hpp
Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2015-03-08 23:06:15 UTC (rev 6126)
+++ lmi/trunk/ChangeLog 2015-03-09 23:00:18 UTC (rev 6127)
@@ -35773,3 +35773,10 @@
Implement rectified test specification. See:
http://lists.nongnu.org/archive/html/lmi/2015-03/msg00017.html
+20150309T2300Z <address@hidden> [516]
+
+ skeleton.cpp
+ skeleton.hpp
+Accept input files as command-line arguments. See:
+ http://lists.nongnu.org/archive/html/lmi/2015-03/msg00022.html
+
Modified: lmi/trunk/skeleton.cpp
===================================================================
--- lmi/trunk/skeleton.cpp 2015-03-08 23:06:15 UTC (rev 6126)
+++ lmi/trunk/skeleton.cpp 2015-03-09 23:00:18 UTC (rev 6127)
@@ -1183,6 +1183,7 @@
{"mellon" ,NO_ARG ,0 ,002 ,0 ,"pedo mellon a minno"},
{"mello" ,NO_ARG ,0 ,003 ,0 ,"fraud"},
{"pyx" ,REQD_ARG ,0 ,'x' ,0 ,"for docimasy"},
+ {"file" ,REQD_ARG ,0 ,'f' ,0 ,"input file to run"},
{"data_path" ,REQD_ARG ,0 ,'d' ,0 ,"path to data files"},
{"print_db" ,NO_ARG ,0 ,'p' ,0 ,"print product databases"},
{"prospicience" ,REQD_ARG ,0 ,004 ,0 ,"validation date"},
@@ -1191,6 +1192,8 @@
bool show_help = false;
+ std::vector<std::string> input_files;
+
int option_index = 0;
GetOpt getopt_long
(argc
@@ -1248,6 +1251,13 @@
}
break;
+ case 'f':
+ {
+ LMI_ASSERT(NULL != getopt_long.optarg);
+ input_files.push_back(getopt_long.optarg);
+ }
+ break;
+
case 'h':
{
show_help = true;
@@ -1312,9 +1322,34 @@
return false;
}
+ if (!input_files.empty())
+ {
+ // Can't open files until main window is initialized.
+ CallAfter(&Skeleton::OpenCommandLineFiles, input_files);
+ }
+
return true;
}
+void Skeleton::OpenCommandLineFiles(std::vector<std::string> const& files)
+{
+ LMI_ASSERT(doc_manager_);
+
+ typedef std::vector<std::string>::const_iterator vsci;
+ for(vsci i = files.begin(); i != files.end(); ++i)
+ {
+ if(!doc_manager_->CreateDocument(*i, wxDOC_SILENT))
+ {
+ warning()
+ << "Document '"
+ << *i
+ << "' specified on command line couldn't be opened."
+ << LMI_FLUSH
+ ;
+ }
+ }
+}
+
void Skeleton::UpdateViews()
{
wxBusyCursor wait;
Modified: lmi/trunk/skeleton.hpp
===================================================================
--- lmi/trunk/skeleton.hpp 2015-03-08 23:06:15 UTC (rev 6126)
+++ lmi/trunk/skeleton.hpp 2015-03-09 23:00:18 UTC (rev 6127)
@@ -41,6 +41,9 @@
#include <wx/app.h>
#include <wx/timer.h>
+#include <string>
+#include <vector>
+
class DocManagerEx;
class ViewEx;
@@ -129,6 +132,7 @@
virtual void OnUnhandledException ();
bool ProcessCommandLine(int argc, char* argv[]);
+ void OpenCommandLineFiles(std::vector<std::string> const& files);
void UpdateViews();
wxConfigBase* config_;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [6127] Accept input files as command-line arguments,
Greg Chicares <=