diff --git a/README.adoc b/README.adoc index 83afd05..d7db803 100644 --- a/README.adoc +++ b/README.adoc @@ -11305,6 +11305,18 @@ You can also choose a different configuration file explicitly with: ./run --config data/config2.py .... +Almost all options names are automatically deduced from their command line `--help` name: just replace `-` with `_`. + +More precisely, we use the `dest=` value of Python's link:https://docs.python.org/3/library/argparse.html[argparse module]. + +To get a list of all global options that you can use, try: + +.... +./getvar --type input +.... + +but note that this does not include script specific options. + === Build the documentation You don't need to depend on GitHub: diff --git a/common.py b/common.py index 24cf4fa..b0aef16 100644 --- a/common.py +++ b/common.py @@ -786,6 +786,7 @@ Valid emulators: {} Time the main of the derived class. ''' env = kwargs.copy() + self.input_args = env.copy() env.update(consts) real_all_archs= env['all_archs'] if real_all_archs: diff --git a/config.py b/config.py index 9f0a606..4846754 100644 --- a/config.py +++ b/config.py @@ -1,3 +1,7 @@ +''' +https://github.com/cirosantilli/linux-kernel-module-cheat#default-command-line-arguments +''' + def set_args(args, script_name): args['arch'] = 'aarch64' args['emulators'] = ['gem5'] diff --git a/getvar b/getvar index 3f62b10..5c24380 100755 --- a/getvar +++ b/getvar @@ -29,6 +29,7 @@ List all available variables: .... ''', ) + self.add_argument('--type', choices=['input', 'all'], default='all') self.add_argument('variable', nargs='?') def timed_main(self): @@ -36,7 +37,11 @@ List all available variables: if variable: print(self.env[variable]) else: - for key in self.env: + if self.env['type'] == 'input': + to_print = self.input_args + elif self.env['type'] == 'all': + to_print = self.env + for key in sorted(to_print): print('{}={}'.format(key, self.env[key])) if __name__ == '__main__':