Skip to content

Commit b7081ac

Browse files
pre-commit-ci[bot]tony
authored andcommitted
[pre-commit.ci] auto fixes from pre-commit.com hookss
for more information, see https://pre-commit.ci
1 parent 8c6ec3f commit b7081ac

File tree

1 file changed

+38
-11
lines changed

1 file changed

+38
-11
lines changed

tmuxp/cli.py

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -911,12 +911,33 @@ def command_shell(
911911
@click.argument('session_name', nargs=1, required=False)
912912
@click.option('-S', 'socket_path', help='pass-through for tmux -S')
913913
@click.option('-L', 'socket_name', help='pass-through for tmux -L')
914-
@click.option('-f', '--config-format', type=click.Choice(['yaml', 'json']), help='format to save in')
914+
@click.option(
915+
'-f',
916+
'--config-format',
917+
type=click.Choice(['yaml', 'json']),
918+
help='format to save in',
919+
)
915920
@click.option('-o', '--save-to', type=click.Path(exists=False), help='file to save to')
916-
@click.option('-y', '--yes', type=bool, is_flag=True, default=False, help="Don't prompt for confirmation")
917-
@click.option('-q', '--quiet', type=bool, is_flag=True, default=False, help="Don't prompt for confirmation")
921+
@click.option(
922+
'-y',
923+
'--yes',
924+
type=bool,
925+
is_flag=True,
926+
default=False,
927+
help="Don't prompt for confirmation",
928+
)
929+
@click.option(
930+
'-q',
931+
'--quiet',
932+
type=bool,
933+
is_flag=True,
934+
default=False,
935+
help="Don't prompt for confirmation",
936+
)
918937
@click.option('--force', 'force', help='overwrite the config file', is_flag=True)
919-
def command_freeze(session_name, socket_name, config_format, save_to, socket_path, yes, quiet, force):
938+
def command_freeze(
939+
session_name, socket_name, config_format, save_to, socket_path, yes, quiet, force
940+
):
920941
"""Snapshot a session into a config.
921942
922943
If SESSION_NAME is provided, snapshot that session. Otherwise, use the
@@ -947,9 +968,12 @@ def command_freeze(session_name, socket_name, config_format, save_to, socket_pat
947968
'\n'
948969
'Freeze does its best to snapshot live tmux sessions.\n'
949970
)
950-
if not (yes or click.confirm(
951-
'The new config *WILL* require adjusting afterwards. Save config?'
952-
)):
971+
if not (
972+
yes
973+
or click.confirm(
974+
'The new config *WILL* require adjusting afterwards. Save config?'
975+
)
976+
):
953977
if not quiet:
954978
print(
955979
'tmuxp has examples in JSON and YAML format at '
@@ -961,7 +985,8 @@ def command_freeze(session_name, socket_name, config_format, save_to, socket_pat
961985
dest = save_to
962986
while not dest:
963987
save_to = os.path.abspath(
964-
os.path.join(get_config_dir(),
988+
os.path.join(
989+
get_config_dir(),
965990
'%s.%s' % (sconf.get('session_name'), config_format or 'yaml'),
966991
)
967992
)
@@ -976,13 +1001,15 @@ def command_freeze(session_name, socket_name, config_format, save_to, socket_pat
9761001
dest = os.path.abspath(os.path.relpath(os.path.expanduser(dest)))
9771002

9781003
if config_format is None:
979-
valid_config_formats = [ 'json', 'yaml' ]
1004+
valid_config_formats = ['json', 'yaml']
9801005
_, config_format = os.path.splitext(dest)
9811006
config_format = config_format[1:].lower()
9821007
if config_format not in valid_config_formats:
9831008
config_format = click.prompt(
984-
"Couldn't ascertain one of [%s] from file name. Convert to" % ", ".join(valid_config_formats),
985-
value_proc=_validate_choices(['yaml', 'json']), default='yaml'
1009+
"Couldn't ascertain one of [%s] from file name. Convert to"
1010+
% ", ".join(valid_config_formats),
1011+
value_proc=_validate_choices(['yaml', 'json']),
1012+
default='yaml',
9861013
)
9871014

9881015
if config_format == 'yaml':

0 commit comments

Comments
 (0)