mirror of
https://github.com/Kiritow/wg-ops.git
synced 2024-03-22 13:11:37 +08:00
Add more command line options
This commit is contained in:
parent
c9ebb2c2c8
commit
1fb94e83ef
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue
Block a user