From 483e07042a7fcd572768410b5182c3f3dec420b0 Mon Sep 17 00:00:00 2001 From: John Paul Adrian Glaubitz Date: Fri, 25 Feb 2022 12:00:06 +0100 Subject: [PATCH] Add -F option to osc submitreq Fixes #1001 --- osc/commandline.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osc/commandline.py b/osc/commandline.py index 524f32cc..fd53c9be 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -1177,6 +1177,8 @@ class Osc(cmdln.Cmdln): @cmdln.option('-m', '--message', metavar='TEXT', help='specify message TEXT') + @cmdln.option('-F', '--file', metavar='FILE', + help='read log message from FILE, \'-\' denotes standard input.') @cmdln.option('-r', '--revision', metavar='REV', help='specify a certain source revision ID (the md5 sum) for the source package') @cmdln.option('-s', '--supersede', metavar='REQUEST_ID', @@ -1257,6 +1259,14 @@ class Osc(cmdln.Cmdln): if opts.message: opts.message = str(opts.message.encode().decode('unicode_escape')) + elif opts.file: + if opts.file == '-': + opts.message = sys.stdin.read() + else: + try: + opts.message = open(opts.file).read() + except: + sys.exit('could not open file \'%s\'.' % opts.file) myreqs = [] if opts.supersede: