@@ -926,9 +926,17 @@ def command_shell(
926926 default = False ,
927927 help = "Don't prompt for confirmation" ,
928928)
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+ )
929937@click .option ('--force' , 'force' , help = 'overwrite the config file' , is_flag = True )
930938def command_freeze (
931- session_name , socket_name , config_format , save_to , socket_path , yes , force
939+ session_name , socket_name , config_format , save_to , socket_path , yes , quiet , force
932940):
933941 """Snapshot a session into a config.
934942
@@ -954,22 +962,24 @@ def command_freeze(
954962 newconfig = config .inline (sconf )
955963 configparser .import_config (newconfig )
956964
957- print (
958- '---------------------------------------------------------------'
959- '\n '
960- 'Freeze does its best to snapshot live tmux sessions.\n '
961- )
965+ if not quiet :
966+ print (
967+ '---------------------------------------------------------------'
968+ '\n '
969+ 'Freeze does its best to snapshot live tmux sessions.\n '
970+ )
962971 if not (
963972 yes
964973 or click .confirm (
965974 'The new config *WILL* require adjusting afterwards. Save config?'
966975 )
967976 ):
968- print (
969- 'tmuxp has examples in JSON and YAML format at '
970- '<http://tmuxp.git-pull.com/examples.html>\n '
971- 'View tmuxp docs at <http://tmuxp.git-pull.com/>.'
972- )
977+ if not quiet :
978+ print (
979+ 'tmuxp has examples in JSON and YAML format at '
980+ '<http://tmuxp.git-pull.com/examples.html>\n '
981+ 'View tmuxp docs at <http://tmuxp.git-pull.com/>.'
982+ )
973983 sys .exit ()
974984
975985 dest = save_to
@@ -1017,16 +1027,8 @@ def command_freeze(
10171027 buf .write (newconfig )
10181028 buf .close ()
10191029
1020- print ('Saved to %s.' % dest )
1021-
1022- if config_format == 'yaml' :
1023- newconfig = configparser .export (
1024- 'yaml' , indent = 2 , default_flow_style = False , safe = True
1025- )
1026- elif config_format == 'json' :
1027- newconfig = configparser .export ('json' , indent = 2 )
1028- else :
1029- sys .exit ('Unknown config format.' )
1030+ if not quiet :
1031+ print ('Saved to %s.' % dest )
10301032
10311033
10321034@cli .command (name = 'load' , short_help = 'Load tmuxp workspaces.' )
0 commit comments