Skip to content

Commit

Permalink
Merge pull request #15 from makermelissa/main
Browse files Browse the repository at this point in the history
Update with buster and allow arguments for prompt_reboot
  • Loading branch information
makermelissa committed Nov 9, 2022
2 parents 758dbc0 + 5cdff5e commit c658112
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions adafruit_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,13 @@ def print_colored(message, color):
colorize = getattr(colored, color)
print(colorize(message))

def prompt(self, message, *, default=None, force_arg=None):
def prompt(self, message, *, default=None, force_arg=None, force_arg_value=True):
"""
A Yes/No prompt that accepts optional defaults
Returns True for Yes and False for No
"""
if force_arg is not None and self.argument_exists(force_arg):
return True
return force_arg_value
if default is None:
choicebox = "[y/n]"
else:
Expand Down Expand Up @@ -491,7 +491,7 @@ def get_raspbian_version(self):
"""Return a string containing the raspbian version"""
if self.get_os() != "Raspbian":
return None
raspbian_releases = ("buster", "stretch", "jessie", "wheezy")
raspbian_releases = ("bullseye", "buster", "stretch", "jessie", "wheezy")
if os.path.exists("/etc/os-release"):
with open("/etc/os-release", encoding="utf-8") as f:
release_file = f.read()
Expand All @@ -502,9 +502,9 @@ def get_raspbian_version(self):
return raspbian
return None

def prompt_reboot(self):
def prompt_reboot(self, default="y", **kwargs):
"""Prompt the user for a reboot"""
if not self.prompt("REBOOT NOW?", default="y"):
if not self.prompt("REBOOT NOW?", default=default, **kwargs):
print("Exiting without reboot.")
else:
print("Reboot started...")
Expand Down

0 comments on commit c658112

Please sign in to comment.