From b9960422cf3b4627e2a3210525e54b3289233c9b Mon Sep 17 00:00:00 2001
From: Justin Berger <j.david.berger@gmail.com>
Date: Sat, 8 Jan 2022 10:33:24 -0700
Subject: [PATCH] Only include non default arguments when invoking process

---
 gooey/gui/components/config.py    | 2 +-
 gooey/python_bindings/cmd_args.py | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/gooey/gui/components/config.py b/gooey/gui/components/config.py
index bd6d68f5..cad08d73 100644
--- a/gooey/gui/components/config.py
+++ b/gooey/gui/components/config.py
@@ -46,7 +46,7 @@ def getPositionalArgs(self):
 
     def getOptionalArgs(self):
         return [widget.getValue()['cmd'] for widget in self.reifiedWidgets
-                if widget.info['cli_type'] != 'positional']
+                if widget.info['cli_type'] != 'positional' and str(widget.getValue()['rawValue']) != str(widget.info['data']['default'])]
 
 
     def isValid(self):
diff --git a/gooey/python_bindings/cmd_args.py b/gooey/python_bindings/cmd_args.py
index 4d0e5e30..3f0dcc1b 100644
--- a/gooey/python_bindings/cmd_args.py
+++ b/gooey/python_bindings/cmd_args.py
@@ -52,8 +52,12 @@ def overwrite_default_values(item, cmd_args):
       else:
         dest = getattr(action, 'dest', None)
         if dest:
-          cmd_arg = getattr(cmd_args, dest, None)
-          if cmd_arg:
+          cmd_arg = getattr(cmd_args, dest, None)        
+          if cmd_arg and dest in item.options and 'initial_value' not in (item.options[dest] or {}):
+            if item.options[dest] is None:
+              item.options[dest] = {}
+            item.options[dest]['initial_value'] = cmd_arg
+          else:
             action.default = cmd_arg
 
   def restore_original_configuration(item):