bitbake-layers: use dashes in subcommands
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Mon, 30 Jan 2012 16:25:50 +0000 (16:25 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 1 Feb 2012 15:08:41 +0000 (15:08 +0000)
Rather than the slightly awkward underscores, use dashes in subcommands
e.g. show-layers instead of show_layers. (The old underscored forms
continue to be accepted however.)

(Bitbake rev: 6d311ddc1be04ae5bd0a1ebee94b44968e8a3f27)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake/bin/bitbake-layers

index b4cfd55..fd1ebfb 100755 (executable)
@@ -38,6 +38,8 @@ def main(args):
 
     cmds = Commands(initialenv)
     if args:
+        # Allow user to specify e.g. show-layers instead of show_layers
+        args = [args[0].replace('-', '_')] + args[1:]
         cmds.onecmd(' '.join(args))
     else:
         cmds.do_help('')
@@ -90,14 +92,14 @@ class Commands(cmd.Cmd):
         """display general help or help on a specified command"""
         if topic:
             sys.stdout.write('%s: ' % topic)
-            cmd.Cmd.do_help(self,topic)
+            cmd.Cmd.do_help(self, topic.replace('-', '_'))
         else:
             sys.stdout.write("usage: bitbake-layers <command> [arguments]\n\n")
             sys.stdout.write("Available commands:\n")
             procnames = self.get_names()
             for procname in procnames:
                 if procname[:3] == 'do_':
-                    sys.stdout.write("  %s\n" % procname[3:])
+                    sys.stdout.write("  %s\n" % procname[3:].replace('_', '-'))
                     doc = getattr(self, procname).__doc__
                     if doc:
                         sys.stdout.write("    %s\n" % doc.splitlines()[0])
@@ -123,7 +125,7 @@ class Commands(cmd.Cmd):
     def do_show_overlayed(self, args):
         """list overlayed recipes (where there is a recipe in another layer that has a higher layer priority)
 
-usage: show_overlayed
+usage: show-overlayed
 
 Highest priority recipes are listed with the recipes they overlay as subitems.
 """
@@ -194,7 +196,7 @@ build results (as the layer priority order has effectively changed).
 
             for layername in layernames:
                 if not layername in found_layernames:
-                    logger.error('Unable to find layer %s in current configuration, please run "%s show_layers" to list configured layers' % (layername, os.path.basename(sys.argv[0])))
+                    logger.error('Unable to find layer %s in current configuration, please run "%s show-layers" to list configured layers' % (layername, os.path.basename(sys.argv[0])))
                     return
             layers = found_layerdirs
         else:
@@ -313,7 +315,7 @@ build results (as the layer priority order has effectively changed).
     def do_show_appends(self, args):
         """list bbappend files and recipe files they apply to
 
-usage: show_appends
+usage: show-appends
 
 Recipes are listed with the bbappends that apply to them as subitems.
 """