Add more command line options

master
Kirigaya Kazuto 2022-03-18 21:22:50 +00:00
parent c9ebb2c2c8
commit 1fb94e83ef
1 changed files with 6 additions and 2 deletions

View File

@ -1,3 +1,4 @@
from ast import parse
import os
import sys
import getopt
@ -5,7 +6,7 @@ from libwgopparser import Parser, errprint
if __name__ == "__main__":
opts, args = getopt.getopt(sys.argv[1:], 'hiko:', ["tmux"])
opts, args = getopt.getopt(sys.argv[1:], 'hiko:', ["tmux", "systemd"])
opts = {p[0]: p[1] for p in opts}
if '-h' in opts:
@ -14,7 +15,8 @@ OPTIONS
-h Display this help and quit.
-k Output generated config to standard output
-o <filename> Output generated config to file. Default is {source_filename}.gen
--tmux Use tmux instead of containers
--tmux Use tmux mode
--systemd Use systemd mode
HELP
For latest help please view https://github.com/Kiritow/wg-ops
''')
@ -33,6 +35,8 @@ HELP
parser.opt_source_path = filepath
if '--tmux' in opts:
parser.opt_use_tmux = True
if '--systemd' in opts:
parser.opt_use_systemd = True
parser.parse(content)
parser.compile_interface()