Ability to set -q option in config file

This commit is contained in:
Marcin Kulik
2016-07-03 21:08:02 +02:00
parent ccec2ef8c6
commit 5428c2725a
3 changed files with 6 additions and 1 deletions

View File

@@ -185,6 +185,7 @@ available options set:
command = /bin/bash -l command = /bin/bash -l
maxwait = 2 maxwait = 2
yes = true yes = true
quiet = true
[play] [play]
maxwait = 1 maxwait = 1

View File

@@ -73,7 +73,7 @@ For help on a specifc command run:
parser_rec.add_argument('-t', '--title', help='title of the asciicast') parser_rec.add_argument('-t', '--title', help='title of the asciicast')
parser_rec.add_argument('-w', '--max-wait', help='limit recorded terminal inactivity to max <sec> seconds (can be fractional)', type=positive_float, default=maybe_str(cfg.record_max_wait)) parser_rec.add_argument('-w', '--max-wait', help='limit recorded terminal inactivity to max <sec> seconds (can be fractional)', type=positive_float, default=maybe_str(cfg.record_max_wait))
parser_rec.add_argument('-y', '--yes', help='answer "yes" to all prompts (e.g. upload confirmation)', action='store_true', default=cfg.record_yes) parser_rec.add_argument('-y', '--yes', help='answer "yes" to all prompts (e.g. upload confirmation)', action='store_true', default=cfg.record_yes)
parser_rec.add_argument('-q', '--quiet', help='be quiet, suppress all notices/warnings (implies -y)', action='store_true') parser_rec.add_argument('-q', '--quiet', help='be quiet, suppress all notices/warnings (implies -y)', action='store_true', default=cfg.record_quiet)
parser_rec.add_argument('filename', nargs='?', default='') parser_rec.add_argument('filename', nargs='?', default='')
parser_rec.set_defaults(func=rec_command) parser_rec.set_defaults(func=rec_command)

View File

@@ -47,6 +47,10 @@ class Config:
def record_yes(self): def record_yes(self):
return self.config.getboolean('record', 'yes', fallback=False) return self.config.getboolean('record', 'yes', fallback=False)
@property
def record_quiet(self):
return self.config.getboolean('record', 'quiet', fallback=False)
@property @property
def play_max_wait(self): def play_max_wait(self):
return self.config.getfloat('play', 'maxwait', fallback=None) return self.config.getfloat('play', 'maxwait', fallback=None)