@@ -913,8 +913,9 @@ def command_shell(
913
913
@click .option ('-f' , '--config-format' , type = click .Choice (['yaml' , 'json' ]), help = 'format to save in' )
914
914
@click .option ('-o' , '--save-to' , type = click .Path (exists = False ), help = 'file to save to' )
915
915
@click .option ('-y' , '--yes' , type = bool , is_flag = True , default = False , help = "Don't prompt for confirmation" )
916
+ @click .option ('-q' , '--quiet' , type = bool , is_flag = True , default = False , help = "Don't prompt for confirmation" )
916
917
@click .option ('--force' , 'force' , help = 'overwrite the config file' , is_flag = True )
917
- def command_freeze (session_name , socket_name , config_format , save_to , socket_path , yes , force ):
918
+ def command_freeze (session_name , socket_name , config_format , save_to , socket_path , yes , quiet , force ):
918
919
"""Snapshot a session into a config.
919
920
920
921
If SESSION_NAME is provided, snapshot that session. Otherwise, use the
@@ -939,19 +940,21 @@ def command_freeze(session_name, socket_name, config_format, save_to, socket_pat
939
940
newconfig = config .inline (sconf )
940
941
configparser .import_config (newconfig )
941
942
942
- print (
943
- '---------------------------------------------------------------'
944
- '\n '
945
- 'Freeze does its best to snapshot live tmux sessions.\n '
946
- )
943
+ if not quiet :
944
+ print (
945
+ '---------------------------------------------------------------'
946
+ '\n '
947
+ 'Freeze does its best to snapshot live tmux sessions.\n '
948
+ )
947
949
if not (yes or click .confirm (
948
950
'The new config *WILL* require adjusting afterwards. Save config?'
949
951
)):
950
- print (
951
- 'tmuxp has examples in JSON and YAML format at '
952
- '<http://tmuxp.git-pull.com/examples.html>\n '
953
- 'View tmuxp docs at <http://tmuxp.git-pull.com/>.'
954
- )
952
+ if not quiet :
953
+ print (
954
+ 'tmuxp has examples in JSON and YAML format at '
955
+ '<http://tmuxp.git-pull.com/examples.html>\n '
956
+ 'View tmuxp docs at <http://tmuxp.git-pull.com/>.'
957
+ )
955
958
sys .exit ()
956
959
957
960
dest = save_to
@@ -996,17 +999,8 @@ def command_freeze(session_name, socket_name, config_format, save_to, socket_pat
996
999
buf .write (newconfig )
997
1000
buf .close ()
998
1001
999
- print ('Saved to %s.' % dest )
1000
-
1001
- if config_format == 'yaml' :
1002
- newconfig = configparser .export (
1003
- 'yaml' , indent = 2 , default_flow_style = False , safe = True
1004
- )
1005
- elif config_format == 'json' :
1006
- newconfig = configparser .export ('json' , indent = 2 )
1007
- else :
1008
- sys .exit ('Unknown config format.' )
1009
-
1002
+ if not quiet :
1003
+ print ('Saved to %s.' % dest )
1010
1004
1011
1005
1012
1006
@cli .command (name = 'load' , short_help = 'Load tmuxp workspaces.' )
0 commit comments