From 50470b5747620f263637f9f50fc8c9ef25f3dcdf Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 15 Dec 2017 13:34:39 +0530 Subject: [PATCH] icat: Add --transfer-mode option Explicitly control the transfer mode instead of auto-detecting --- kitty/icat.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/kitty/icat.py b/kitty/icat.py index 9c4b9b393..760609b96 100755 --- a/kitty/icat.py +++ b/kitty/icat.py @@ -46,6 +46,17 @@ type=choices choices=center,left,right default=center Horizontal alignment for the displayed image. Defaults to centered. + + +--transfer-mode +type=choices +choices=detect,file,stream +default=detect +What mechanism to use to transfer images to the terminal. The default is to +auto-detect. |_ file| means to use a temporary file and |_ stream| means to +send the data via terminal escape codes. Note that if you use the |_ file| +transfer mode and you are connecting over a remote session then image display +will not work. ''' @@ -256,13 +267,16 @@ def main(args=sys.argv): ) msg = ( 'A cat like utility to display images in the terminal.' - ' You can specify multiple images files and/or directories.' + ' You can specify multiple image files and/or directories.' ' Directories are scanned recursively for image files.') args, items = parse_args(args[1:], options_spec, 'image-file ...', msg, '{} icat'.format(appname)) if not items: raise SystemExit('You must specify at least one file to cat') - if not detect_support(): - raise SystemExit('This terminal emulator does not support the graphics protocol, use a terminal emulator such as kitty that does support it') + if args.transfer_mode == 'detect': + if not detect_support(): + raise SystemExit('This terminal emulator does not support the graphics protocol, use a terminal emulator such as kitty that does support it') + else: + detect_support.has_files = args.transfer_mode == 'file' errors = [] for item in items: try: