summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool/upgrade.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-02-19 22:38:53 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-21 09:32:42 +0000
commit32ef52389833a8b8dfb63444ace6561bb0ac741c (patch)
tree59f597df4ce685609706c7db90ee0eb654b044a5 /scripts/lib/devtool/upgrade.py
parent9f7df76eb49eac1ec7627061a8219e5d0b052034 (diff)
downloadpoky-32ef52389833a8b8dfb63444ace6561bb0ac741c.tar.gz
devtool: categorise and order subcommands in help output
The listing of subcommands in the --help output for devtool was starting to get difficult to follow, with commands appearing in no particular order (due to some being in separate modules and the order of those modules being parsed). Logically grouping the subcommands as well as being able to exercise some control over the order of the subcommands and groups would help, if we do so without losing the dynamic nature of the list (i.e. that it comes from the plugins). Argparse provides no built-in way to handle this and really, really makes it a pain to add, but with some subclassing and hacking it's now possible, and can be extended by any plugin as desired. To put a subcommand into a group, all you need to do is specify a group= parameter in the call to subparsers.add_parser(). you can also specify an order= parameter to make the subcommand sort higher or lower in the list (higher order numbers appear first, so use negative numbers to force items to the end if that's what you want). To add a new group, use subparsers.add_subparser_group(), supplying the name, description and optionally an order number for the group itself (again, higher numbers appear first). (From OE-Core rev: e1b9d31e6ea3c254ecfe940fe795af44761e0e69) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/devtool/upgrade.py')
-rw-r--r--scripts/lib/devtool/upgrade.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index e2be38e7af..0e53c8286e 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -339,7 +339,8 @@ def upgrade(args, config, basepath, workspace):
339def register_commands(subparsers, context): 339def register_commands(subparsers, context):
340 """Register devtool subcommands from this plugin""" 340 """Register devtool subcommands from this plugin"""
341 parser_upgrade = subparsers.add_parser('upgrade', help='Upgrade an existing recipe', 341 parser_upgrade = subparsers.add_parser('upgrade', help='Upgrade an existing recipe',
342 description='Upgrades an existing recipe to a new upstream version. Puts the upgraded recipe file into the workspace along with any associated files, and extracts the source tree to a specified location (in case patches need rebasing or adding to as a result of the upgrade).') 342 description='Upgrades an existing recipe to a new upstream version. Puts the upgraded recipe file into the workspace along with any associated files, and extracts the source tree to a specified location (in case patches need rebasing or adding to as a result of the upgrade).',
343 group='starting')
343 parser_upgrade.add_argument('recipename', help='Name of recipe to upgrade (just name - no version, path or extension)') 344 parser_upgrade.add_argument('recipename', help='Name of recipe to upgrade (just name - no version, path or extension)')
344 parser_upgrade.add_argument('srctree', help='Path to where to extract the source tree') 345 parser_upgrade.add_argument('srctree', help='Path to where to extract the source tree')
345 parser_upgrade.add_argument('--version', '-V', help='Version to upgrade to (PV)') 346 parser_upgrade.add_argument('--version', '-V', help='Version to upgrade to (PV)')