mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-27 20:14:27 +01:00
only forward common args that were given, stop forwarding _args_given
This commit is contained in:
@@ -162,7 +162,6 @@ class CliFunction:
|
|||||||
Resolve default arguments from the config file and CLI param defaults.
|
Resolve default arguments from the config file and CLI param defaults.
|
||||||
|
|
||||||
Add an extra _args_given argument which determines if an argument was given or not.
|
Add an extra _args_given argument which determines if an argument was given or not.
|
||||||
If _args_given is already present in kwargs, preserve it.
|
|
||||||
'''
|
'''
|
||||||
args_with_defaults = kwargs.copy()
|
args_with_defaults = kwargs.copy()
|
||||||
# Add missing args from config file.
|
# Add missing args from config file.
|
||||||
@@ -198,10 +197,7 @@ class CliFunction:
|
|||||||
args_with_defaults[key] = argument.default
|
args_with_defaults[key] = argument.default
|
||||||
else:
|
else:
|
||||||
raise Exception('Value not given for mandatory argument: ' + key)
|
raise Exception('Value not given for mandatory argument: ' + key)
|
||||||
if '_args_given' in kwargs:
|
args_with_defaults['_args_given'] = args_given
|
||||||
args_with_defaults['_args_given'] = kwargs['_args_given']
|
|
||||||
else:
|
|
||||||
args_with_defaults['_args_given'] = args_given
|
|
||||||
if 'config_file' in args_with_defaults:
|
if 'config_file' in args_with_defaults:
|
||||||
del args_with_defaults['config_file']
|
del args_with_defaults['config_file']
|
||||||
return args_with_defaults
|
return args_with_defaults
|
||||||
|
|||||||
@@ -682,7 +682,9 @@ Valid emulators: {}
|
|||||||
and are all defined in this class instead of in the derived class
|
and are all defined in this class instead of in the derived class
|
||||||
of the script.
|
of the script.
|
||||||
'''
|
'''
|
||||||
return {key:self.env[key] for key in self._common_args | {'_args_given'}}
|
return {
|
||||||
|
key:self.env[key] for key in self._common_args if self.env['_args_given'][key]
|
||||||
|
}
|
||||||
|
|
||||||
def get_stats(self, stat_re=None, stats_file=None):
|
def get_stats(self, stat_re=None, stats_file=None):
|
||||||
if stat_re is None:
|
if stat_re is None:
|
||||||
|
|||||||
Reference in New Issue
Block a user