fix config command
This commit is contained in:
parent
05985ff46a
commit
4691987cc4
@ -44,17 +44,21 @@ def main():
|
||||
configparser = moduleparser.add_parser("config", help="Configuration actions")
|
||||
configcommandparser = configparser.add_subparsers(title="Commands", dest="command")
|
||||
|
||||
migrateparser = configcommandparser.add_parser("migrate", help="Migrage configuration files")
|
||||
migrateparser = configcommandparser.add_parser("migrate", help="Migrate configuration files")
|
||||
migrateparser.set_defaults(cls=MigrateCommand)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.version:
|
||||
print("OpenWebRX version {version}".format(version=openwebrx_version))
|
||||
elif args.module in ["admin", "config"]:
|
||||
elif args.module == "admin":
|
||||
# override loglevel for admin commands, they shouldn't be that verbose
|
||||
logging.basicConfig(level=logging.INFO, force=True)
|
||||
run_admin_action(adminparser, args)
|
||||
elif args.module == "config":
|
||||
# override loglevel for config commands, they shouldn't be that verbose
|
||||
logging.basicConfig(level=logging.INFO, force=True)
|
||||
run_admin_action(configparser, args)
|
||||
else:
|
||||
start_receiver()
|
||||
|
||||
|
@ -39,11 +39,12 @@ def add_admin_parser(moduleparser):
|
||||
)
|
||||
moduleparser.add_argument("--silent", action="store_true", help="Ignore errors (useful for automation)")
|
||||
|
||||
|
||||
def run_admin_action(parser, args):
|
||||
if hasattr(args, "cls"):
|
||||
command = args.cls()
|
||||
else:
|
||||
if not args.silent:
|
||||
if not hasattr(args, "silent") or not args.silent:
|
||||
parser.print_help()
|
||||
sys.exit(1)
|
||||
sys.exit(0)
|
||||
|
Loading…
Reference in New Issue
Block a user