src/eric7/UI/UserInterface.py

branch
eric7
changeset 10303
ee1aadab1215
parent 10301
b4299b82fe37
child 10308
d19766190e17
diff -r 8cb0dabf852f -r ee1aadab1215 src/eric7/UI/UserInterface.py
--- a/src/eric7/UI/UserInterface.py	Sat Nov 11 10:13:29 2023 +0100
+++ b/src/eric7/UI/UserInterface.py	Sat Nov 11 12:44:51 2023 +0100
@@ -1613,72 +1613,49 @@
         """
         Public method to process the command line args passed to the UI.
 
-        @param args list of files to open<br />
-            The args are processed one at a time. All arguments after a
-            '--' option are considered debug arguments to the program
-            for the debugger. All files named before the '--' option
-            are opened in a text editor, unless the argument ends in
-            .epj or .e4p, then it is opened as a project file. If it
-            ends in .emj, .e4m or .e5m, it is opened as a multi project.
+        @param args namespace object containing the parsed command line
+            parameters
+        @type argparse.Namespace
         """
         # check and optionally read a crash session and ignore any arguments
         if self.__readCrashSession():
             return
 
-        # no args, return
-        if args is None:
-            if self.__openAtStartup:
-                self.__openOnStartup()
+        if args.dd_args:
+            # store away any args we had
+            argsStr = " ".join(args.dd_args)
+            self.debuggerUI.setArgvHistory(argsStr)
+
+        if args.start_file:
+            self.__openOnStartup("File")
+            return
+        elif args.start_multi:
+            self.__openOnStartup("MultiProject")
+            return
+        elif args.start_project:
+            self.__openOnStartup("Project")
+            return
+        elif args.start_session:
+            self.__openOnStartup("Session")
             return
 
         opens = 0
-
-        if "--" in args:
-            # store args after a '--' as a space delimited list of command args, if any
-            ddindex = args.index("--")
-            argsStr = " ".join(args[ddindex + 1:])
-            args = args[:ddindex]
-        else:
-            argsStr = None
-
-        for arg in args:
-            # handle a request to start with last session
-            if arg == "--start-file":
-                self.__openOnStartup("File")
-                # ignore all further arguments
-                return
-            elif arg == "--start-multi":
-                self.__openOnStartup("MultiProject")
-                # ignore all further arguments
-                return
-            elif arg == "--start-project":
-                self.__openOnStartup("Project")
-                # ignore all further arguments
-                return
-            elif arg == "--start-session":
-                self.__openOnStartup("Session")
-                # ignore all further arguments
-                return
-
+        for filename in args.file_or_project:
             try:
-                ext = os.path.normcase(os.path.splitext(arg)[1])
+                ext = os.path.normcase(os.path.splitext(filename)[1])
             except IndexError:
                 ext = ""
 
             if ext in (".epj", ".e4p"):
-                self.project.openProject(arg)
+                self.project.openProject(filename)
                 opens += 1
             elif ext in (".emj", ".e4m", ".e5m"):
-                self.multiProject.openMultiProject(arg)
+                self.multiProject.openMultiProject(filename)
                 opens += 1
             else:
-                self.viewmanager.openFiles(arg)
+                self.viewmanager.openFiles(filename)
                 opens += 1
 
-        # store away any args we had
-        if argsStr is not None:
-            self.debuggerUI.setArgvHistory(argsStr)
-
         if opens == 0 and self.__openAtStartup:
             # no files, project or multiproject was given
             self.__openOnStartup()

eric ide

mercurial