Validate command line args to @ goto-layout better

This commit is contained in:
Kovid Goyal 2021-05-13 20:46:37 +05:30
parent e089e9c121
commit 4125ac013f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -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)