diff mbox

[U-Boot,v3,02/45] moveconfig: Add an option to skip prompts

Message ID 1473743943-15003-3-git-send-email-sjg@chromium.org
State Accepted
Commit 6b403dfd2e0de791b1c635460e04791162e70ba0
Delegated to: Tom Rini
Headers show

Commit Message

Simon Glass Sept. 13, 2016, 5:18 a.m. UTC
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 <sjg@chromium.org>
---

Changes in v3: None
Changes in v2:
- Add some notes on this option to moveconfig.py

 tools/moveconfig.py | 37 +++++++++++++++++++++++--------------
 1 file changed, 23 insertions(+), 14 deletions(-)

Comments

Tom Rini Sept. 18, 2016, 3:58 p.m. UTC | #1
On Mon, Sep 12, 2016 at 11:18:20PM -0600, Simon Glass wrote:

> 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 <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index bdfa039..52ec1bd 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -162,6 +162,10 @@  Available options
  -v, --verbose
    Show any build errors as boards are built
 
+ -y, --yes
+   Instead of prompting, automatically go ahead with all operations. This
+   includes cleaning up headers and CONFIG_SYS_EXTRA_OPTIONS.
+
 To see the complete list of supported options, run
 
   $ tools/moveconfig.py -h
@@ -482,14 +486,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:
@@ -561,14 +566,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 ]
 
@@ -1252,6 +1259,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 ...'