From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Glass Date: Wed, 24 Aug 2016 10:51:45 -0600 Subject: [U-Boot] [PATCH 01/42] moveconfig: Add an option to skip prompts In-Reply-To: <1472057546-10360-1-git-send-email-sjg@chromium.org> References: <1472057546-10360-1-git-send-email-sjg@chromium.org> Message-ID: <1472057546-10360-2-git-send-email-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de At present it is not easy to use moveconfig from a script since it asks for user input a few times. Add a -y option to skip this and assume that 'y' was entered. Signed-off-by: Simon Glass --- tools/moveconfig.py | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/tools/moveconfig.py b/tools/moveconfig.py index 5eebab8..290270a 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -473,14 +473,15 @@ def cleanup_headers(configs, options): configs: A list of CONFIGs to remove. options: option flags. """ - while True: - choice = raw_input('Clean up headers? [y/n]: ').lower() - print choice - if choice == 'y' or choice == 'n': - break + if not options.yes: + while True: + choice = raw_input('Clean up headers? [y/n]: ').lower() + print choice + if choice == 'y' or choice == 'n': + break - if choice == 'n': - return + if choice == 'n': + return patterns = [] for config in configs: @@ -552,14 +553,16 @@ def cleanup_extra_options(configs, options): configs: A list of CONFIGs to remove. options: option flags. """ - while True: - choice = raw_input('Clean up CONFIG_SYS_EXTRA_OPTIONS? [y/n]: ').lower() - print choice - if choice == 'y' or choice == 'n': - break + if not options.yes: + while True: + choice = (raw_input('Clean up CONFIG_SYS_EXTRA_OPTIONS? [y/n]: '). + lower()) + print choice + if choice == 'y' or choice == 'n': + break - if choice == 'n': - return + if choice == 'n': + return configs = [ config[len('CONFIG_'):] for config in configs ] @@ -1212,6 +1215,8 @@ def main(): help='the number of jobs to run simultaneously') parser.add_option('-r', '--git-ref', type='string', help='the git ref to clone for building the autoconf.mk') + parser.add_option('-y', '--yes', action='store_true', default=False, + help="respond 'yes' to any prompts") parser.add_option('-v', '--verbose', action='store_true', default=False, help='show any build errors as boards are built') parser.usage += ' CONFIG ...' -- 2.8.0.rc3.226.g39d4020