openwebrx-clone/owrxadmin/__main__.py

23 lines
783 B
Python
Raw Normal View History

2021-02-06 17:04:32 +00:00
from owrx.version import openwebrx_version
2021-02-06 17:15:02 +00:00
from owrxadmin.commands import NewUser, DeleteUser
2021-02-06 17:04:32 +00:00
import argparse
import sys
2021-02-06 15:43:54 +00:00
def main():
2021-02-06 17:04:32 +00:00
print("OpenWebRX admin version {version}".format(version=openwebrx_version))
parser = argparse.ArgumentParser()
parser.add_argument("command", help="One of the following commands: adduser, removeuser")
parser.add_argument("--noninteractive", action="store_true", help="Don't ask for any user input (useful for automation)")
parser.add_argument("-u", "--user")
args = parser.parse_args()
if args.command == "adduser":
2021-02-06 17:15:02 +00:00
NewUser().run(args)
2021-02-06 17:04:32 +00:00
elif args.command == "removeuser":
2021-02-06 17:15:02 +00:00
DeleteUser().run(args)
2021-02-06 17:04:32 +00:00
else:
print("Unknown command: {command}".format(command=args.command))
sys.exit(1)