From 4125ac013f4fbe451e6302b076eb0129616c4e5d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 13 May 2021 20:46:37 +0530 Subject: [PATCH] Validate command line args to @ goto-layout better --- kitty/rc/goto_layout.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/kitty/rc/goto_layout.py b/kitty/rc/goto_layout.py index d5fa64d6e..a897c4958 100644 --- a/kitty/rc/goto_layout.py +++ b/kitty/rc/goto_layout.py @@ -29,10 +29,9 @@ class GotoLayout(RemoteCommand): argspec = 'LAYOUT_NAME' def message_to_kitty(self, global_opts: RCOptions, opts: 'CLIOptions', args: ArgsType) -> PayloadType: - try: - return {'layout': args[0], 'match': opts.match} - except IndexError: - raise self.fatal('No layout specified') + if len(args) != 1: + self.fatal('Exactly one layout must be specified') + return {'layout': args[0], 'match': opts.match} def response_from_kitty(self, boss: Boss, window: Optional[Window], payload_get: PayloadGetType) -> ResponseType: tabs = self.tabs_for_match_payload(boss, window, payload_get)