forked from amrwc/macos-automation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
goodnight.py
executable file
·63 lines (45 loc) · 1.1 KB
/
goodnight.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python3
"""
# Good Night
A utility for performing some of the common shutting down operations from
command-line in combination.
## Setup
Create a symlink to the script.
```console
ln -s "$(pwd)/goodnight.py" /usr/local/bin/goodnight
```
## Usage
```console
goodnight
```
@author: amrwc
"""
from typing import List
from abstract_automation import Automation
from bluetooth import Bluetooth
from sleep import Sleep
from utils import (
log,
print_coloured,
)
from volume import Volume
from wifi import Wifi
class Goodnight(Automation):
def execute(self) -> str:
log('Good night!')
automations = [
Volume(['0.0']),
Bluetooth(['off']),
Wifi(['off']),
Sleep(),
]
for automation in automations:
automation.execute()
return ''
def parse_argv(self, argv: List[str] = []) -> List[str]:
return []
def usage(self) -> None:
print_coloured('Usage:\n', 'white', 'bold')
print_coloured('$ ./goodnight.py\n', 'white')
if __name__ == '__main__':
Goodnight().execute()