Fix invocation of the image cat script as kitty icat
This commit is contained in:
parent
664975b707
commit
49aeae4aad
@ -7,7 +7,7 @@ sys.debug_gl = '--debug-kitty-gl' in sys.argv
|
|||||||
|
|
||||||
if len(sys.argv) > 1 and sys.argv[1] == 'icat':
|
if len(sys.argv) > 1 and sys.argv[1] == 'icat':
|
||||||
from kitty.icat import main
|
from kitty.icat import main
|
||||||
main()
|
main(sys.argv[1:])
|
||||||
else:
|
else:
|
||||||
from kitty.main import main
|
from kitty.main import main
|
||||||
main()
|
main()
|
||||||
|
|||||||
@ -40,7 +40,7 @@ def option_parser():
|
|||||||
a = parser.add_argument
|
a = parser.add_argument
|
||||||
a(
|
a(
|
||||||
'items',
|
'items',
|
||||||
nargs=argparse.REMAINDER,
|
nargs='+',
|
||||||
help=_(
|
help=_(
|
||||||
'Image files or directories. Directories are scanned recursively.'
|
'Image files or directories. Directories are scanned recursively.'
|
||||||
)
|
)
|
||||||
@ -173,7 +173,7 @@ def scan(d):
|
|||||||
yield os.path.join(dirpath, f), mt
|
yield os.path.join(dirpath, f), mt
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main(args=sys.argv):
|
||||||
signal.signal(signal.SIGWINCH, lambda: screen_size(refresh=True))
|
signal.signal(signal.SIGWINCH, lambda: screen_size(refresh=True))
|
||||||
if not sys.stdout.isatty():
|
if not sys.stdout.isatty():
|
||||||
raise SystemExit(
|
raise SystemExit(
|
||||||
@ -183,7 +183,7 @@ def main():
|
|||||||
raise SystemExit(
|
raise SystemExit(
|
||||||
'Terminal does not support reporting screen sizes via the TIOCGWINSZ ioctl'
|
'Terminal does not support reporting screen sizes via the TIOCGWINSZ ioctl'
|
||||||
)
|
)
|
||||||
args = option_parser().parse_args()
|
args = option_parser().parse_args(args[1:])
|
||||||
if not args.items:
|
if not args.items:
|
||||||
raise SystemExit('You must specify at least one file to cat')
|
raise SystemExit('You must specify at least one file to cat')
|
||||||
errors = []
|
errors = []
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user