
    Mg                     V   S SK r S SKJrJrJrJrJr  \" \S9\" S5      S 5       5       r\" \S9\" S5      S 5       5       r\" \S9\" S5      S 5       5       r\" \S9\" S5      S	 5       5       r	\" \S9\" S5      S
 5       5       r
\" \S9\" S5      S 5       5       r\" S\S9\" S5      S 5       5       r\" \S9\" S5      S 5       5       r\" S\S9\" S5      S 5       5       r\" \S9\" S5      S 5       5       r\" \S9\" S5      S 5       5       r\" S\S9\" S5      S 5       5       rg)    N)pluginrequireLINUXMACOSWINDOWS)platformshutdownc                     US:X  a  U R                  S5      nUS:X  a(  [        R                  " S5        U R                  S5        gS[	        U5      -   n[        R                  " U5        g)S
Shutdown the system
Uses:
shutdown : asks for time
shutdown -c : cancels shutdown
 In how many minutes?: -czsudo shutdown -cShutdown operation cancelledNzsudo shutdown -t inputossystemsaystrjarvissstrings      >/Users/admin/workspace/ai/Jarvis/jarviscli/plugins/shutdown.pyshutdown_LINUXr      sX     	BwLL12Dy
		$%

12 3q6)FIIf    c                     US:X  a  U R                  S5      nUS:X  a(  [        R                  " S5        U R                  S5        gS[	        U5      -   n[        R                  " U5        g)r   r   r   r   zsudo killall shutdownr   Nzsudo shutdown -h +r   r   s      r   shutdown_MACOSr      sX     	BwLL12Dy
		)*

12!CF*FIIfr   c                     US:X  a  U R                  S5      nUS:X  a(  [        R                  " S5        U R                  S5        gS[	        U5      -   n[        R                  " U5        g)r   r   In how many seconds?: r   zshutdown /ar   Nzsudo shutdown /s /t r   r   s      r   shutdown_WIN32r!   +   sW     	BwLL12Dy
		- 

12#c!f,FIIfr   reboot_computerc                 z    US:X  a  U R                  S5      nS[        U5      -   n[        R                  " U5        g)Reboot the systemr   r   zsudo shutdown -r -t Nr   r   r   r   r   s      r   reboot_LINUXr&   >   s4     	BwLL12#c!f,FIIfr   c                     US:X  aY  U R                  S5      nUS:X  a)  U R                  S5        Sn[        R                  " U5        US:X  a  U R                  S5        ggg)	r$   r   zreboot? y/n: yzrebooting systemzsudo shutdown -r nownzreboot cancelledN)r   r   r   r   r   s      r   reboot_MACOSr*   H   s_     	BwLL)8JJ)*+FIIf8JJ)*  r   c                 z    US:X  a  U R                  S5      nS[        U5      -   n[        R                  " U5        g)r$   r   r    zshutdown /r /t Nr%   r   s      r   reboot_WIN32r,   W   s4     	BwLL12Q'FIIfr   	systemctl)nativer   	hibernatec                 0    [         R                  " S5        g)z
Hibernate - also known as "Suspend to Disk"

Saves everything running to disk and performs shutdown.
Next reboot computer will restore everything - including
Programs and open files like the shutdown never happened.
zsudo systemctl hibernateNr   r   r   r   s     r   hibernate_LINUXr3   a   s     II()r   c                 4    Sn[         R                  " U5        g)zHibernates the systemzshutdown /hNr1   r   s      r   hibernate_WIN32r5   n        FIIfr   hybridsleepc                 0    [         R                  " S5        g)z
Hybrid sleep.
Will quickly wake up but also survive power cut.
Performs both suspend AND hibernate.
Will quickly wake up but also survive power cut.
zsudo systemctl hybrid-sleepNr1   r2   s     r   hybridsleep_LINUXr9   v   s     II+,r   c                 4    Sn[         R                  " U5        g)z.Performs shutdown and prepares forfast startupzshutdown /hybridNr1   r   s      r   hybridsleep_WIN32r;      s      FIIfr   zlog offc                 4    Sn[         R                  " U5        g)zLog off the systemzshutdown /lNr1   r   s      r   log_off_WIN32r=      r6   r   suspendc                 0    [         R                  " S5        g)zv
Suspend (to RAM) - also known as Stand By or Sleep mode.

Operate PC on a minimum to save power but quickly wake up.
zsudo systemctl suspendNr1   r2   s     r   suspend_LINUXr@      s     II&'r   )r   r   r   r   r   r   r   r   r!   r&   r*   r,   r3   r5   r9   r;   r=   r@    r   r   <module>rB      s   	 9 9 	%
  " 	%
  " 	'
  " 	%   	%
  
 	'   	e,*  -* 	'   	e,-  -- 	'   	'	   	e,	(  -(r   