-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmserve
executable file
·40 lines (32 loc) · 870 Bytes
/
mserve
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
#!/usr/bin/env python
# docstring=serve files with http.
import subprocess as sp
import argparse
CFG = {
"base": [
"miniserve",
"--auth=guest:Super9000!",
"--color-scheme-dark=monokai",
"--qrcode",
"--dirs-first",
"--hide-version-footer",
"--show-wget-footer",
"--title=Rano's quick share",
],
"folder": "./"
}
def main():
ap = argparse.ArgumentParser()
ap.add_argument("-u", "--upload", help="enable upload", action="store_true")
args = ap.parse_args()
cmd = CFG["base"]
if args.upload:
cmd.extend(["--upload-files=./", "--overwrite-files"])
cmd.append(CFG["folder"])
try:
sp.run(cmd)
except KeyboardInterrupt:
print("\ninterrupted by user")
if __name__ == "__main__":
main()
# implement a switch for easy --upload-files=DIR