File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
files/system/usr/libexec/secureblue Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 5050
5151
5252def ask_option (options_count : int ) -> int :
53- """Returns the user's chosen number between 1 and options_count."""
53+ """Returns the user's chosen number between 0 and options_count."""
5454
5555 while True :
56- raw_option = interruptible_ask (f"Choose an option [1 -{ options_count } ]: " )
56+ raw_option = interruptible_ask (f"Choose an option [0 -{ options_count } ]: " )
5757 if raw_option .isdigit ():
5858 option = int (raw_option )
5959 if 1 <= option <= options_count :
6060 print ()
6161 return option
62- print (f"Please enter a number between 1 and { options_count } ." )
62+ print (f"Please enter a number between 0 and { options_count } ." )
6363
6464
6565def ask_yes_no (prompt : str ) -> bool :
@@ -264,6 +264,8 @@ def run_interactive() -> int:
264264 textwrap .dedent (
265265 f"""
266266 What DNS settings would you like to modify?
267+ { BOLD } 0. Exit.{ RESET }
268+ Exit without applying any changes.
267269 { BOLD } 1. Reset to defaults.{ RESET }
268270 Uses the Unbound resolver with DNSSEC disabled.
269271 { BOLD } 2. Configure DNS over HTTPS in Trivalent.{ RESET }
@@ -291,6 +293,10 @@ def run_interactive() -> int:
291293
292294 exit_code = 1
293295 match mode :
296+ case 0 :
297+ # Exit
298+ exit_code = 1
299+
294300 case 1 :
295301 # Reset to defaults.
296302 exit_code = sandbox .run (dns_function , "reset" )
@@ -557,7 +563,8 @@ def main() -> int:
557563 print ("Invalid option selected. Try --help." , file = sys .stderr )
558564 return 1
559565
560- print_all_status ()
566+ if exit_code != 1 :
567+ print_all_status ()
561568 return exit_code
562569
563570
You can’t perform that action at this time.
0 commit comments