summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/recipetool24
1 files changed, 16 insertions, 8 deletions
diff --git a/scripts/recipetool b/scripts/recipetool
index 37c2dd31f4..87fb35ed72 100755
--- a/scripts/recipetool
+++ b/scripts/recipetool
@@ -46,12 +46,25 @@ def main():
46 sys.exit(1) 46 sys.exit(1)
47 47
48 parser = argparse.ArgumentParser(description="OpenEmbedded recipe tool", 48 parser = argparse.ArgumentParser(description="OpenEmbedded recipe tool",
49 add_help=False,
49 epilog="Use %(prog)s <subcommand> --help to get help on a specific command") 50 epilog="Use %(prog)s <subcommand> --help to get help on a specific command")
50 parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true') 51 parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true')
51 parser.add_argument('-q', '--quiet', help='Print only errors', action='store_true') 52 parser.add_argument('-q', '--quiet', help='Print only errors', action='store_true')
52 parser.add_argument('--color', choices=['auto', 'always', 'never'], default='auto', help='Colorize output (where %(metavar)s is %(choices)s)', metavar='COLOR') 53 parser.add_argument('--color', choices=['auto', 'always', 'never'], default='auto', help='Colorize output (where %(metavar)s is %(choices)s)', metavar='COLOR')
54
55 global_args, unparsed_args = parser.parse_known_args()
56
57 # Help is added here rather than via add_help=True, as we don't want it to
58 # be handled by parse_known_args()
59 parser.add_argument('-h', '--help', action='help', default=argparse.SUPPRESS,
60 help='show this help message and exit')
53 subparsers = parser.add_subparsers(title='subcommands', metavar='<subcommand>') 61 subparsers = parser.add_subparsers(title='subcommands', metavar='<subcommand>')
54 62
63 if global_args.debug:
64 logger.setLevel(logging.DEBUG)
65 elif global_args.quiet:
66 logger.setLevel(logging.ERROR)
67
55 import scriptpath 68 import scriptpath
56 bitbakepath = scriptpath.add_bitbake_lib_path() 69 bitbakepath = scriptpath.add_bitbake_lib_path()
57 if not bitbakepath: 70 if not bitbakepath:
@@ -59,6 +72,8 @@ def main():
59 sys.exit(1) 72 sys.exit(1)
60 logger.debug('Found bitbake path: %s' % bitbakepath) 73 logger.debug('Found bitbake path: %s' % bitbakepath)
61 74
75 scriptutils.logger_setup_color(logger, global_args.color)
76
62 tinfoil = tinfoil_init(False) 77 tinfoil = tinfoil_init(False)
63 for path in ([scripts_path] + 78 for path in ([scripts_path] +
64 tinfoil.config_data.getVar('BBPATH', True).split(':')): 79 tinfoil.config_data.getVar('BBPATH', True).split(':')):
@@ -77,14 +92,7 @@ def main():
77 logger.error("No commands registered - missing plugins?") 92 logger.error("No commands registered - missing plugins?")
78 sys.exit(1) 93 sys.exit(1)
79 94
80 args = parser.parse_args() 95 args = parser.parse_args(unparsed_args, namespace=global_args)
81
82 if args.debug:
83 logger.setLevel(logging.DEBUG)
84 elif args.quiet:
85 logger.setLevel(logging.ERROR)
86
87 scriptutils.logger_setup_color(logger, args.color)
88 96
89 try: 97 try:
90 if getattr(args, 'parserecipes', False): 98 if getattr(args, 'parserecipes', False):