diff mbox series

[1/3] bitbake-setup: allow to pass a prompt to int_input

Message ID 20251203-bitbake-setup-input-consistent-v1-1-3c7e6edecd57@cherry.de
State New
Headers show
Series bitbake-setup: improve consistency in prompts | expand

Commit Message

Quentin Schulz Dec. 3, 2025, 12:15 p.m. UTC
From: Quentin Schulz <quentin.schulz@cherry.de>

This will allow us to have consistency between expected user inputs by
having them all doing something along the lines of:

Type number: 2

instead of

Type number:
2

This migrates the retry prompts to use that new mechanism.

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
---
 bin/bitbake-setup | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index 75be90940..54faa7e30 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -330,16 +330,16 @@  def update_build(config, confdir, setupdir, layerdir, d, update_bb_conf="prompt"
     setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir, update_bb_conf)
     write_sources_fixed_revisions(confdir, sources_fixed_revisions)
 
-def int_input(allowed_values):
+def int_input(allowed_values, prompt=''):
     n = None
     while n is None:
         try:
-            n = int(input())
+            n = int(input(prompt))
         except ValueError:
-            print('Not a valid number, please try again:')
+            prompt = 'Not a valid number, please try again: '
             continue
         if n not in allowed_values:
-            print('Number {} not one of {}, please try again:'.format(n, allowed_values))
+            prompt = 'Number {} not one of {}, please try again: '.format(n, allowed_values)
             n = None
     return n