mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-13 20:12:26 +00:00
33 lines
926 B
Python
Executable File
33 lines
926 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import common
|
|
|
|
class Main(common.LkmcCliFunction):
|
|
def __init__(self):
|
|
super().__init__(
|
|
defaults = {
|
|
'show_time': False,
|
|
},
|
|
description='''\
|
|
Print the value of a self.env['py'] variable.
|
|
https://cirosantilli.com/linux-kernel-module-cheat#getvar
|
|
''',
|
|
)
|
|
self.add_argument('--type', choices=['input', 'all'], default='all')
|
|
self.add_argument('variable', nargs='?')
|
|
|
|
def timed_main(self):
|
|
variable = self.env['variable']
|
|
if variable:
|
|
print(self.env[variable])
|
|
else:
|
|
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__':
|
|
Main().cli()
|