Mailinglist Archive: yast-commit (190 mails)

< Previous Next >
[yast-commit] r38182 - in /trunk/autoinstallation: package/autoyast2.changes src/clients/autoyast.ycp
  • From: ug@xxxxxxxxxxxxxxxx
  • Date: Tue, 29 May 2007 14:32:44 -0000
  • Message-id: <20070529143244.E5CD14821C@xxxxxxxxxxxxxxxx>
Author: ug
Date: Tue May 29 16:32:44 2007
New Revision: 38182

URL: http://svn.opensuse.org/viewcvs/yast?rev=38182&view=rev
Log:
added command line interface for opening files

Modified:
    trunk/autoinstallation/package/autoyast2.changes
    trunk/autoinstallation/src/clients/autoyast.ycp

Modified: trunk/autoinstallation/package/autoyast2.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/autoinstallation/package/autoyast2.changes?rev=38182&r1=38181&r2=38182&view=diff
==============================================================================
--- trunk/autoinstallation/package/autoyast2.changes (original)
+++ trunk/autoinstallation/package/autoyast2.changes Tue May 29 16:32:44 2007
@@ -1,4 +1,9 @@
 -------------------------------------------------------------------
+Tue May 29 16:32:15 CEST 2007 - ug@xxxxxxx
+
+- added command line interface for opening files
+
+-------------------------------------------------------------------
 Fri May 25 13:30:04 CEST 2007 - jsrain@xxxxxxx
 
 - removed outdated translations from .desktop-files (#271209)

Modified: trunk/autoinstallation/src/clients/autoyast.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/autoinstallation/src/clients/autoyast.ycp?rev=38182&r1=38181&r2=38182&view=diff
==============================================================================
--- trunk/autoinstallation/src/clients/autoyast.ycp (original)
+++ trunk/autoinstallation/src/clients/autoyast.ycp Tue May 29 16:32:44 2007
@@ -18,6 +18,7 @@
     import "Sequencer";
     import "Popup";
     import "AddOnProduct";
+    import "CommandLine";
 
     include "autoinstall/dialogs.ycp";
     include "autoinstall/conftree.ycp";
@@ -37,6 +38,63 @@
     Pkg::CallbackAcceptFileWithoutChecksum("AutoInstall::callbackTrue");
     Pkg::CallbackAcceptUnsignedFile("AutoInstall::callbackTrue");
 
+    void openFile( map <string, any> options ) {
+        if( !Profile::ReadXML( options["filename"]:"" ) ) {
+            Popup::Error(_("Error while parsing the control file.
+Check the log files for more details or fix the
+control file and try again.
+"));
+        }
+    }
+
+
+    map cmdline = $[
+        "id"        : "autoyast2",
+        "help"      : _("autoyast"),
+        "actions"   : $[
+            "file" :   $[ "handler":openFile, "help":"sure" ]
+        ],
+        "options"       : $[
+            "filename": $[
+                "type":"string",
+                "help":"no help"
+            ]
+        ],
+        "mappings"      : $[
+            "file"  :   ["filename"]
+        ]
+    ];
+    if(!CommandLine::Init(cmdline, WFM::Args()))
+    {
+        y2error("Commandline init failed");
+        return (symbol)AutoSequence ();
+    }
+    // command line options
+    /* Init variables */
+    string command = "";
+    list flags = [];
+    map<string,any> options = $[];
+    string exit = "";
+    list l = [];
+
+    while(!CommandLine::Done())
+    {
+        map m = CommandLine::Command();
+        command = m["command"]:"exit";
+        options = m["options"]:$[];
+
+        if( command == "file" ) {
+            openFile(options);
+        } else {
+            /* maybe we got "exit" or "quit" */
+            if( !CommandLine::Done() ) {
+                CommandLine::Print("Unknown command (should not happen)");
+                continue;
+            }
+        }
+    }
+
+
     symbol ret = (symbol)AutoSequence ();
     AddOnProduct::CleanModeConfigSources();
     return ret;

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages