CliFunction

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-01-22 00:00:00 +00:00
parent 3b0a343647
commit a5ec63dc28
39 changed files with 2630 additions and 2399 deletions

13
getvar
View File

@@ -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('__'):