diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-05-07 11:52:20 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-05-07 11:52:20 -0400 |
commit | 56b965b2e30d483145a737062151616a3628960c (patch) | |
tree | 7be920499024f71bb2bed31a0afe19ae43872077 /b4/ty.py | |
parent | afd622604f9ec4360d50b6e32b11fc66e44d62a1 (diff) | |
download | b4-56b965b2e30d483145a737062151616a3628960c.tar.gz |
Switch ty -s and -d to allow friendly ranges
Instead of insisting that people put in specific numbers, allow them to
specify ranges, such as:
b4 ty -s 1-3,5,7-
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Diffstat (limited to 'b4/ty.py')
-rw-r--r-- | b4/ty.py | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -450,11 +450,11 @@ def send_selected(cmdargs): logger.info('Nothing to do') sys.exit(0) - if 'all' in cmdargs.send: + if cmdargs.send == 'all': listing = tracked else: listing = list() - for num in cmdargs.send: + for num in b4.parse_int_range(cmdargs.send, upper=len(tracked)): try: index = int(num) - 1 listing.append(tracked[index]) @@ -483,11 +483,11 @@ def discard_selected(cmdargs): logger.info('Nothing to do') sys.exit(0) - if 'all' in cmdargs.discard: + if cmdargs.discard == 'all': listing = tracked else: listing = list() - for num in cmdargs.discard: + for num in b4.parse_int_range(cmdargs.discard, upper=len(tracked)): try: index = int(num) - 1 listing.append(tracked[index]) @@ -612,5 +612,5 @@ def main(cmdargs): sys.exit(0) write_tracked(tracked) logger.info('---') - logger.info('You can send them using:') - logger.info(' b4 ty -s 1 [2 3 ...]') + logger.info('You can send them using number ranges, e.g:') + logger.info(' b4 ty -s 1-3,5,7-') |