bitbake-setup: Improve continue prompt
PATCH 1/1 bitbake-setup: Improve continue prompt
Reworks the prompt to continue with the setup wizard in a number of ways:
1) Default to 'Y' if the user just hits enter. In general, users are more likely to want to continue than they want to exit.
2) The tools prints "Exiting" when the user doesn't want to continue, as a clear indication that the script exited without doing anything.
--- bin/bitbake-setup | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
bin/bitbake-setup +10 -9
@@ -134,6 +134,14 @@ def checkout_layers(layers, layerdir, d): return layers_fixed_revisions +def prompt_continue(non_interactive): + if not non_interactive: + p = input('Continue? (Y/n): ') + if p and p.lower() != 'y': + print("Exiting") + exit() + print() + def setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir): def _setup_build_conf(layers, filerelative_layers, build_conf_dir): os.makedirs(build_conf_dir)
@@ -483,11 +491,7 @@ def init_config(top_dir, settings, args, d): return print("Initializing a setup directory in\n {}".format(setupdir)) - if not args.non_interactive: - y_or_n = input('Continue? (y/N): ') - if y_or_n != 'y': - exit() - print() + prompt_continue(args.non_interactive) os.makedirs(setupdir, exist_ok=True)
@@ -676,10 +680,7 @@ def create_siteconf(top_dir, non_interactive=True): print('A site.conf file already exists. Please remove it if you would like to replace it with a default one') else: print('A common site.conf file will be created, please edit or replace before running builds\n {}\n'.format(siteconfpath)) - if not non_interactive: - y_or_n = input('Proceed? (y/N): ') - if y_or_n != 'y': - exit() + prompt_continue(non_interactive) os.makedirs(os.path.dirname(top_dir), exist_ok=True) with open(siteconfpath, 'w') as siteconffile:
Signature · 1 line
2.51.1
Hello,
Quoted 5 lines · Joshua Watt via lists.openembedded.org
Reworks the prompt to continue with the setup wizard in a number of ways:
1) Default to 'Y' if the user just hits enter. In general, users are more likely to want to continue than they want to exit.
In the absence of Alex, I'd like to remind what he said about defaulting to
No: https://lists.openembedded.org/g/bitbake-devel/message/18113:
Quoted 6 lines
There was some discussion as to whether this should be Y/n (e.g. hit Enter to proceed). I'd rather err on the cautious side here, as people nowadays have muscle memory to agree and accept with anything and everything, and proceed as quickly as possible, they would do it here too, without reading what the tool is going to do, and only then realize it's not what they wanted.
Personally, I'm slightly in favor of defaulting to Yes: This will make the experience more fluid for new users and answering Y instead of N is not that dangerous for bitbake-setup (IIRC, we're not erasing any data just putting files in an unexpected directory)
Quoted 69 lines
2) The tools prints "Exiting" when the user doesn't want to continue, as a clear indication that the script exited without doing anything.
Signed-off-by Joshua Watt <[email protected]>--- bin/bitbake-setup | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)bin/bitbake-setup +10
-9@@ -134,6 +134,14 @@ def checkout_layers(layers, layerdir, d): return layers_fixed_revisions +def prompt_continue(non_interactive): + if not non_interactive: + p = input('Continue? (Y/n): ') + if p and p.lower() != 'y': + print("Exiting") + exit() + print() + def setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir): def _setup_build_conf(layers, filerelative_layers, build_conf_dir): os.makedirs(build_conf_dir)@@ -483,11 +491,7 @@ def init_config(top_dir, settings, args, d): return print("Initializing a setup directory in\n {}".format(setupdir)) - if not args.non_interactive: - y_or_n = input('Continue? (y/N): ') - if y_or_n != 'y': - exit() - print() + prompt_continue(args.non_interactive) os.makedirs(setupdir, exist_ok=True)@@ -676,10 +680,7 @@ def create_siteconf(top_dir, non_interactive=True): print('A site.conf file already exists. Please remove it if you would like to replace it with a default one') else: print('A common site.conf file will be created, please edit or replace before running builds\n {}\n'.format(siteconfpath)) - if not non_interactive: - y_or_n = input('Proceed? (y/N): ') - if y_or_n != 'y': - exit() + prompt_continue(non_interactive)
os.makedirs(os.path.dirname(top_dir), exist_ok=True)withopen(siteconfpath, 'w')as siteconffile:
--
2.51.1-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#18332):
https://lists.openembedded.org/g/bitbake-devel/message/18332
Mute This Topic: https://lists.openembedded.org/mt/116242231/4316185
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 2 lines
Yoann Congal Smile ECS
Quoted 21 lines · Yoann Congal
Hello,
Quoted 5 lines · Joshua Watt via lists.openembedded.org
Reworks the prompt to continue with the setup wizard in a number of ways:
1) Default to 'Y' if the user just hits enter. In general, users are more likely to want to continue than they want to exit.In the absence of Alex, I'd like to remind what he said about defaulting to No: https://lists.openembedded.org/g/bitbake-devel/message/18113:
Quoted 7 lines
There was some discussion as to whether this should be Y/n (e.g. hit Enter to proceed). I'd rather err on the cautious side here, as people nowadays have muscle memory to agree and accept with anything and everything, and proceed as quickly as possible, they would do it here too, without reading what the tool is going to do, and only then realize it's not what they wanted.
Quoted 1 line
Personally, I'm slightly in favor of defaulting to Yes: This will make the experience more fluid for new users and answering Y instead of N is not that dangerous for bitbake-setup (IIRC, we're not erasing any data just putting files in an unexpected directory)
That's fine. If we don't want to merge this I'm not going to argue.
Quoted 71 lines
Quoted 58 lines
2) The tools prints "Exiting" when the user doesn't want to continue, as a clear indication that the script exited without doing anything.
Signed-off-by Joshua Watt <[email protected]>--- bin/bitbake-setup | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)bin/bitbake-setup +10
-10@@ -134,6 +134,14 @@ def checkout_layers(layers, layerdir, d): return layers_fixed_revisions +def prompt_continue(non_interactive): + if not non_interactive: + p = input('Continue? (Y/n): ') + if p and p.lower() != 'y': + print("Exiting") + exit() + print() + def setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir): def _setup_build_conf(layers, filerelative_layers, build_conf_dir): os.makedirs(build_conf_dir)@@ -483,11 +491,7 @@ def init_config(top_dir, settings, args, d): return print("Initializing a setup directory in\n {}".format(setupdir)) - if not args.non_interactive: - y_or_n = input('Continue? (y/N): ') - if y_or_n != 'y': - exit() - print() + prompt_continue(args.non_interactive) os.makedirs(setupdir, exist_ok=True)@@ -676,10 +680,7 @@ def create_siteconf(top_dir, non_interactive=True): print('A site.conf file already exists. Please remove it if you would like to replace it with a default one') else: print('A common site.conf file will be created, please edit or replace before running builds\n {}\n'.format(siteconfpath)) - if not non_interactive: - y_or_n = input('Proceed? (y/N): ') - if y_or_n != 'y': - exit() + prompt_continue(non_interactive) os.makedirs(os.path.dirname(top_dir), exist_ok=True) with open(siteconfpath, 'w') as siteconffile: --2.51.1
Quoted 8 lines
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#18332): https://lists.openembedded.org/g/bitbake-devel/message/18332
Mute This Topic: https://lists.openembedded.org/mt/116242231/4316185
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=---
Yoann Congal
Smile ECS