-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjy
More file actions
executable file
·32 lines (23 loc) · 789 Bytes
/
jy
File metadata and controls
executable file
·32 lines (23 loc) · 789 Bytes
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
#!/usr/bin/env python
# pylint: disable=C0103
# pylint: disable=C0111
# pip install pytoml
# pip install pyfunctional
import subprocess
from os import path
def open_browser(url: str, cmd: str = 'x-www-browser'):
subprocess.Popen([cmd, url], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
if __name__ == '__main__':
import pytoml as toml
import os.path
#from functional import seq
TOML_FILE = 'jiayou.toml'
toml_file = path.join(os.path.dirname(__file__), TOML_FILE)
print(f'load urls from {toml_file}...')
with open(toml_file, 'rb') as f:
config = toml.load(f)
for url in config['urls']:
print(f'open {url}...')
open_browser(url)
# seq(obj['urls']).for_each(open_browser)