Skip to content

Commit

Permalink
added shutdown to CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp2310 committed Sep 11, 2022
1 parent 597f27b commit 2433f76
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions AliceCli/MainMenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def mainMenu(ctx: click.Context):
Choice(lambda: ctx.invoke(systemLogs), name='Check system logs'),
Separator(line='\n------- Tools -------'),
Choice(lambda: ctx.invoke(reboot), name='Reboot device'),
Choice(lambda: ctx.invoke(shutdown), name='Shutdown device'),
Choice(lambda: ctx.invoke(uninstallSoundDevice), name='Uninstall your sound device'),
Choice(lambda: ctx.invoke(disableRespeakerLeds), name='Turn off Respeaker bright white leds'),
Choice(lambda: sys.exit(0), name='Exit')
Expand Down
14 changes: 14 additions & 0 deletions AliceCli/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,20 @@ def reboot(ctx: click.Context, return_to_main_menu: bool = True): # NOSONAR
commons.returnToMainMenu(ctx, pause=True)


@click.command(name='shutdown')
@click.pass_context
@checkConnection
def shutdown(ctx: click.Context, return_to_main_menu: bool = True): # NOSONAR
click.secho('Shutting down device, please wait', fg='yellow')

commons.waitAnimation()
commons.sshCmd('sudo shutdown now')
ctx.invoke(commons.disconnect)
commons.printSuccess('Device shut down!')

if return_to_main_menu:
commons.returnToMainMenu(ctx, pause=True)

@click.command(name='updateSystem')
@click.pass_context
@checkConnection
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

setup(
name='projectalice-cli',
version='1.3.28',
version='1.3.29',
long_description=Path('README.md').read_text(encoding='utf8'),
long_description_content_type='text/markdown',
python_requires='>=3.8',
Expand Down

0 comments on commit 2433f76

Please sign in to comment.