diff --git a/jarviscli/CmdInterpreter.py b/jarviscli/CmdInterpreter.py index 4af26354b..017b2e777 100644 --- a/jarviscli/CmdInterpreter.py +++ b/jarviscli/CmdInterpreter.py @@ -39,7 +39,7 @@ def say(self, text, color="", speak=True): and talk when sound is enable. :param text: the text to print (or talk) :param color: for text - use colorama (https://pypi.org/project/colorama/) - e.g. Fore.BLUE + e.g. Fore.CYAN :param speak: False-, if text shouldn't be spoken even if speech is enabled """ print(color + text + Fore.RESET, flush=True) @@ -275,7 +275,7 @@ def incorrect_option(self): A function to notify the user that an incorrect option has been entered and prompting him to enter a correct one """ - self.say("Oops! Looks like you entered an incorrect option", Fore.RED) + self.say("Oops! Looks like you entered an incorrect option", Fore.MAGENTA) self.say("Look at the options once again:", Fore.GREEN) @@ -290,7 +290,7 @@ def try_do(self, s): if self._api.is_spinner_running(): self.spinner_stop("It seems some error has occured") print( - Fore.RED + Fore.MAGENTA + "Some error occurred, please open an issue on github!") print("Here is error:") print('') @@ -346,8 +346,8 @@ def __init__( self.speech = create_voice( self, gtts_status, rate=self.speech_rate) except Exception as e: - self.say("Voice not supported", Fore.RED) - self.say(str(e), Fore.RED) + self.say("Voice not supported", Fore.MAGENTA) + self.say(str(e), Fore.MAGENTA) self.fixed_responses = {"what time is it": "clock", "where am i": "pinpoint", @@ -369,14 +369,14 @@ def _init_plugin_info(self): plugin_status_formatter = { "disabled": len(self._plugin_manager.get_disabled()), "enabled": self._plugin_manager.get_number_plugins_loaded(), - "red": Fore.RED, - "blue": Fore.BLUE, + "magenta": Fore.MAGENTA, + "cyan": Fore.CYAN, "reset": Fore.RESET } - plugin_status = "{red}{enabled} {blue}plugins loaded" + plugin_status = "{magenta}{enabled} {cyan}plugins loaded" if plugin_status_formatter['disabled'] > 0: - plugin_status += " {red}{disabled} {blue}plugins disabled. More information: {red}status\n" + plugin_status += " {magenta}{disabled} {cyan}plugins disabled. More information: {magenta}status\n" plugin_status += Fore.RESET self.first_reaction_text += plugin_status.format( @@ -428,7 +428,7 @@ def close(self): if self._api.is_spinner_running(): self._api.spinner_stop('Some error has occured') - self.say("Goodbye, see you later!", Fore.RED) + self.say("Goodbye, see you later!", Fore.MAGENTA) self.scheduler.stop_all() sys.exit() @@ -438,7 +438,7 @@ def execute_once(self, command): def error(self): """Jarvis let you know if an error has occurred.""" - self.say("I could not identify your command...", Fore.RED) + self.say("I could not identify your command...", Fore.MAGENTA) def interrupt_handler(self, signal, frame): """Closes Jarvis on SIGINT signal. (Ctrl-C)""" @@ -469,7 +469,7 @@ def do_help(self, arg): headerString = "These are valid commands for Jarvis" formatString = "Format: command ([aliases for command])" self.say(headerString) - self.say(formatString, Fore.BLUE) + self.say(formatString, Fore.CYAN) pluginDict = self._plugin_manager.get_plugins() uniquePlugins = {} for key in pluginDict.keys(): diff --git a/jarviscli/Jarvis.py b/jarviscli/Jarvis.py index dba472878..b4a87052b 100644 --- a/jarviscli/Jarvis.py +++ b/jarviscli/Jarvis.py @@ -34,17 +34,17 @@ class Jarvis(CmdInterpreter, object): # variable used at Breakpoint #1. # allows Jarvis say "Hi", only at the first interaction. first_reaction_text = "" - first_reaction_text += Fore.BLUE + \ + first_reaction_text += Fore.CYAN + \ 'Jarvis\' sound is by default disabled.' + Fore.RESET first_reaction_text += "\n" - first_reaction_text += Fore.BLUE + 'In order to let Jarvis talk out loud type: ' - first_reaction_text += Fore.RESET + Fore.RED + 'enable sound' + Fore.RESET + first_reaction_text += Fore.CYAN + 'In order to let Jarvis talk out loud type: ' + first_reaction_text += Fore.RESET + Fore.MAGENTA + 'enable sound' + Fore.RESET first_reaction_text += "\n" - first_reaction_text += Fore.BLUE + \ + first_reaction_text += Fore.CYAN + \ "Type 'help' for a list of available actions." + Fore.RESET first_reaction_text += "\n" prompt = ( - Fore.RED + Fore.MAGENTA + "{} Hi, what can I do for you?\n".format(PROMPT_CHAR) + Fore.RESET) @@ -79,7 +79,7 @@ def _rel_path_fix(self, dirs): def default(self, data): """Jarvis let's you know if an error has occurred.""" - print_say("I could not identify your command...", self, Fore.RED) + print_say("I could not identify your command...", self, Fore.MAGENTA) def precmd(self, line): """Hook that executes before every command.""" @@ -106,7 +106,7 @@ def postcmd(self, stop, line): """Hook that executes after every command.""" if self.first_reaction: self.prompt = ( - Fore.RED + Fore.MAGENTA + "{} What can I do for you?\n".format(PROMPT_CHAR) + Fore.RESET) self.first_reaction = False diff --git a/jarviscli/plugins/shutdown.py b/jarviscli/plugins/shutdown.py index 755779657..f99474b04 100644 --- a/jarviscli/plugins/shutdown.py +++ b/jarviscli/plugins/shutdown.py @@ -60,7 +60,7 @@ def shutdown_WIN32(jarvis, s): @require(platform=LINUX) -@plugin('reboot') +@plugin('reboot_computer') def reboot_LINUX(jarvis, s): """Reboot the system""" if s == '': @@ -70,15 +70,22 @@ def reboot_LINUX(jarvis, s): @require(platform=MACOS) -@plugin('reboot') +@plugin('reboot_computer') def reboot_MACOS(jarvis, s): """Reboot the system""" - string = 'sudo shutdown -r now' - os.system(string) + if s == '': + s = jarvis.input('reboot? y/n: ') + if s == 'y': + jarvis.say('rebooting system') + string = 'sudo shutdown -r now' + os.system(string) + if s == 'n': + jarvis.say('reboot cancelled') + return @require(platform=WINDOWS) -@plugin('reboot') +@plugin('reboot_computer') def reboot_WIN32(jarvis, s): """Reboot the system""" if s == '':