From d3c00353da0aa831de043f765feff36fb0a56abd Mon Sep 17 00:00:00 2001 From: JustAnotherArchivist Date: Wed, 11 Mar 2020 20:58:41 +0000 Subject: [PATCH] Make con-d-commands mode an alias of the corresponding format --- archivebot-jobs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/archivebot-jobs b/archivebot-jobs index ed263eb..9b2d14b 100755 --- a/archivebot-jobs +++ b/archivebot-jobs @@ -89,6 +89,10 @@ if args.mode == 'format' and not args.format: if not args.sort: args.sort = [parse_sort(defaultSort)] +if args.mode == 'con-d-commands': + args.mode = 'format' + args.format = '!con {jobid} {con}\n!d {jobid} {delay_min} {delay_max}' + # Retrieve def fetch(url): req = urllib.request.Request(url) @@ -153,11 +157,6 @@ jobs = sorted(jobs, key = lambda job: tuple(job[column] if not descending else r if args.mode == 'dashboard-regex': print('^(' + '|'.join(re.escape(job['url']) for job in jobs) + ')$') sys.exit(0) -elif args.mode == 'con-d-commands': - for job in jobs: - print(f'!con {job["jobid"]} {job["con"]}') - print(f'!d {job["jobid"]} {job["delay min"]} {job["delay max"]}') - sys.exit(0) elif args.mode == 'format': for job in jobs: print(args.format.format(**{key.replace(' ', '_'): value for key, value in job.items()}))