summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-11-23 21:03:41 +0300
committerSimon Glass <sjg@chromium.org>2021-12-02 19:16:30 +0300
commit650e5de7d407a3a9d2a9cc693eb8b1290a768d65 (patch)
treece32d70613ad3df760647b4eb1f73699c7f1e024 /tools
parent40b4d647c606b6df7394333c1a58c10996c96a78 (diff)
downloadu-boot-650e5de7d407a3a9d2a9cc693eb8b1290a768d65.tar.xz
binman: Tidy up style in cmdline
Update this file to improve the pylint score a little. The remaining item is: Function name "ParseArgs" doesn't conform to snake_case naming style which needs some binman-wide renaming. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/binman/cmdline.py45
1 files changed, 27 insertions, 18 deletions
diff --git a/tools/binman/cmdline.py b/tools/binman/cmdline.py
index e73ff78095..14ec95c25b 100644
--- a/tools/binman/cmdline.py
+++ b/tools/binman/cmdline.py
@@ -2,18 +2,38 @@
# Copyright (c) 2016 Google, Inc
# Written by Simon Glass <sjg@chromium.org>
#
-# Command-line parser for binman
-#
+
+"""Command-line parser for binman"""
from argparse import ArgumentParser
+def make_extract_parser(subparsers):
+ """make_extract_parser: Make a subparser for the 'extract' command
+
+ Args:
+ subparsers (ArgumentParser): parser to add this one to
+ """
+ extract_parser = subparsers.add_parser('extract',
+ help='Extract files from an image')
+ extract_parser.add_argument('-i', '--image', type=str, required=True,
+ help='Image filename to extract')
+ extract_parser.add_argument('-f', '--filename', type=str,
+ help='Output filename to write to')
+ extract_parser.add_argument('-O', '--outdir', type=str, default='',
+ help='Path to directory to use for output files')
+ extract_parser.add_argument('paths', type=str, nargs='*',
+ help='Paths within file to extract (wildcard)')
+ extract_parser.add_argument('-U', '--uncompressed', action='store_true',
+ help='Output raw uncompressed data for compressed entries')
+
def ParseArgs(argv):
"""Parse the binman command-line arguments
Args:
- argv: List of string arguments
+ argv (list of str): List of string arguments
+
Returns:
- Tuple (options, args) with the command-line options and arugments.
+ tuple: (options, args) with the command-line options and arugments.
options provides access to the options (e.g. option.debug)
args is a list of string arguments
"""
@@ -74,8 +94,8 @@ controlled by a description in the board device tree.'''
build_parser.add_argument('--update-fdt-in-elf', type=str,
help='Update an ELF file with the output dtb: infile,outfile,begin_sym,end_sym')
- entry_parser = subparsers.add_parser('entry-docs',
- help='Write out entry documentation (see entries.rst)')
+ subparsers.add_parser(
+ 'entry-docs', help='Write out entry documentation (see entries.rst)')
list_parser = subparsers.add_parser('ls', help='List files in an image')
list_parser.add_argument('-i', '--image', type=str, required=True,
@@ -83,18 +103,7 @@ controlled by a description in the board device tree.'''
list_parser.add_argument('paths', type=str, nargs='*',
help='Paths within file to list (wildcard)')
- extract_parser = subparsers.add_parser('extract',
- help='Extract files from an image')
- extract_parser.add_argument('-i', '--image', type=str, required=True,
- help='Image filename to extract')
- extract_parser.add_argument('-f', '--filename', type=str,
- help='Output filename to write to')
- extract_parser.add_argument('-O', '--outdir', type=str, default='',
- help='Path to directory to use for output files')
- extract_parser.add_argument('paths', type=str, nargs='*',
- help='Paths within file to extract (wildcard)')
- extract_parser.add_argument('-U', '--uncompressed', action='store_true',
- help='Output raw uncompressed data for compressed entries')
+ make_extract_parser(subparsers)
replace_parser = subparsers.add_parser('replace',
help='Replace entries in an image')