mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-26 19:51:35 +01:00
CliFunction
This commit is contained in:
13
getvar
13
getvar
@@ -3,14 +3,15 @@
|
||||
import types
|
||||
|
||||
import common
|
||||
from shell_helpers import LF
|
||||
|
||||
parser = common.get_argparse(argparse_args={
|
||||
'description': '''Print the value of a common.py variable.
|
||||
parser = self.get_argparse(argparse_args={
|
||||
'description': '''Print the value of a kwargs['py'] variable.
|
||||
|
||||
This is useful to:
|
||||
|
||||
* give dry commands on the README that don't change when we refactor directory structure
|
||||
* create simple bash scripts that call use common.py variables
|
||||
* create simple bash scripts that call use kwargs['py'] variables
|
||||
|
||||
For example, to get the Buildroot output directory for an ARM build, use:
|
||||
|
||||
@@ -27,9 +28,9 @@ List all available variables:
|
||||
'''
|
||||
})
|
||||
parser.add_argument('variable', nargs='?')
|
||||
args = common.setup(parser)
|
||||
if args.variable:
|
||||
print(getattr(common, args.variable))
|
||||
args = self.setup(parser)
|
||||
if kwargs['variable']:
|
||||
print(getattr(common, kwargs['variable']))
|
||||
else:
|
||||
for attr in dir(common):
|
||||
if not attr.startswith('__'):
|
||||
|
||||
Reference in New Issue
Block a user