Show error message when remote command arguments are invalid
This commit is contained in:
parent
4ce4176bbe
commit
a0559e506b
@ -37,7 +37,10 @@ Apply marker to the window this command is run in, rather than the active window
|
|||||||
def message_to_kitty(self, global_opts: RCOptions, opts: 'CLIOptions', args: ArgsType) -> PayloadType:
|
def message_to_kitty(self, global_opts: RCOptions, opts: 'CLIOptions', args: ArgsType) -> PayloadType:
|
||||||
if len(args) < 2:
|
if len(args) < 2:
|
||||||
self.fatal('Invalid marker specification: {}'.format(' '.join(args)))
|
self.fatal('Invalid marker specification: {}'.format(' '.join(args)))
|
||||||
|
try:
|
||||||
parse_marker_spec(args[0], args[1:])
|
parse_marker_spec(args[0], args[1:])
|
||||||
|
except Exception as err:
|
||||||
|
self.fatal(f"Failed to parse marker specification {' '.join(args)} with error: {err}")
|
||||||
return {'match': opts.match, 'self': opts.self, 'marker_spec': args}
|
return {'match': opts.match, 'self': opts.self, 'marker_spec': args}
|
||||||
|
|
||||||
def response_from_kitty(self, boss: Boss, window: Optional[Window], payload_get: PayloadGetType) -> ResponseType:
|
def response_from_kitty(self, boss: Boss, window: Optional[Window], payload_get: PayloadGetType) -> ResponseType:
|
||||||
|
|||||||
@ -35,6 +35,8 @@ class ScrollWindow(RemoteCommand):
|
|||||||
options_spec = MATCH_WINDOW_OPTION
|
options_spec = MATCH_WINDOW_OPTION
|
||||||
|
|
||||||
def message_to_kitty(self, global_opts: RCOptions, opts: 'CLIOptions', args: ArgsType) -> PayloadType:
|
def message_to_kitty(self, global_opts: RCOptions, opts: 'CLIOptions', args: ArgsType) -> PayloadType:
|
||||||
|
if len(args) < 1:
|
||||||
|
self.fatal('Scroll amount must be specified')
|
||||||
amt = args[0]
|
amt = args[0]
|
||||||
amount: Tuple[Union[str, int], Optional[str]] = (amt, None)
|
amount: Tuple[Union[str, int], Optional[str]] = (amt, None)
|
||||||
if amt not in ('start', 'end'):
|
if amt not in ('start', 'end'):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user