Document a couple more commands

This commit is contained in:
Kovid Goyal 2019-06-12 13:20:54 +05:30
parent 4c242ec528
commit d34e0b325e
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -423,11 +423,15 @@ def goto_layout(boss, window, payload):
options_spec=MATCH_TAB_OPTION, options_spec=MATCH_TAB_OPTION,
) )
def cmd_last_used_layout(global_opts, opts, args): def cmd_last_used_layout(global_opts, opts, args):
'''
match: Which tab to change the layout of
'''
return {'match': opts.match} return {'match': opts.match}
def last_used_layout(boss, window, payload): def last_used_layout(boss, window, payload):
match = payload['match'] pg = cmd_last_used_layout.payload_get
match = pg(payload, 'match')
if match: if match:
if match == 'all': if match == 'all':
tabs = tuple(boss.all_tabs) tabs = tuple(boss.all_tabs)
@ -454,17 +458,22 @@ If specified close the window this command is run in, rather than the active win
argspec='' argspec=''
) )
def cmd_close_window(global_opts, opts, args): def cmd_close_window(global_opts, opts, args):
'''
match: Which window to change the layout of
self: Boolean indicating whether to close the window the command is run in
'''
return {'match': opts.match, 'self': opts.self} return {'match': opts.match, 'self': opts.self}
def close_window(boss, window, payload): def close_window(boss, window, payload):
match = payload['match'] pg = cmd_close_window.payload_get
match = pg(payload, 'match')
if match: if match:
windows = tuple(boss.match_windows(match)) windows = tuple(boss.match_windows(match))
if not windows: if not windows:
raise MatchError(match) raise MatchError(match)
else: else:
windows = [window if window and payload['self'] else boss.active_window] windows = [window if window and pg(payload, 'self') else boss.active_window]
for window in windows: for window in windows:
if window: if window:
boss.close_window(window) boss.close_window(window)