@@ -143,7 +143,7 @@ def _validate_choices(options):
143
143
def func (value ):
144
144
if value not in options :
145
145
raise click .BadParameter (
146
- "Possible choices are: {0 }." .format (", " .join (options ))
146
+ "Possible choices are: {}." .format (", " .join (options ))
147
147
)
148
148
return value
149
149
@@ -188,7 +188,7 @@ def set_layout_hook(session, hook_name):
188
188
# unfortunately, select-layout won't work unless
189
189
# we've literally selected the window at least once
190
190
# with the client
191
- hook_cmd .append ("selectw -t {}" . format ( window .id ) )
191
+ hook_cmd .append (f "selectw -t { window .id } " )
192
192
# edit: removed -t, or else it won't respect main-pane-w/h
193
193
hook_cmd .append ("selectl" )
194
194
hook_cmd .append ("selectw -p" )
@@ -199,7 +199,7 @@ def set_layout_hook(session, hook_name):
199
199
target_session = session .id , hook_name = hook_name
200
200
)
201
201
)
202
- hook_cmd .append ("selectw -t {}" . format ( attached_window .id ) )
202
+ hook_cmd .append (f "selectw -t { attached_window .id } " )
203
203
204
204
# join the hook's commands with semicolons
205
205
hook_cmd = "{}" .format ("; " .join (hook_cmd ))
@@ -236,7 +236,7 @@ def is_pure_name(path):
236
236
237
237
class ConfigPath (click .Path ):
238
238
def __init__ (self , config_dir = None , * args , ** kwargs ):
239
- super (ConfigPath , self ).__init__ (* args , ** kwargs )
239
+ super ().__init__ (* args , ** kwargs )
240
240
self .config_dir = config_dir
241
241
242
242
def convert (self , value , param , ctx ):
@@ -245,7 +245,7 @@ def convert(self, value, param, ctx):
245
245
config_dir = config_dir ()
246
246
247
247
value = scan_config (value , config_dir = config_dir )
248
- return super (ConfigPath , self ).convert (value , param , ctx )
248
+ return super ().convert (value , param , ctx )
249
249
250
250
251
251
def scan_config_argument (ctx , param , value , config_dir = None ):
@@ -264,7 +264,7 @@ def scan_config_argument(ctx, param, value, config_dir=None):
264
264
value = scan_config (value , config_dir = config_dir )
265
265
266
266
elif isinstance (value , tuple ):
267
- value = tuple ([ scan_config (v , config_dir = config_dir ) for v in value ] )
267
+ value = tuple (scan_config (v , config_dir = config_dir ) for v in value )
268
268
269
269
return value
270
270
@@ -346,7 +346,7 @@ def scan_config(config, config_dir=None):
346
346
candidates = [
347
347
x
348
348
for x in [
349
- "%s%s" % ( join (config_dir , config ), ext )
349
+ f" { join (config_dir , config )} { ext } "
350
350
for ext in VALID_CONFIG_DIR_FILE_EXTENSIONS
351
351
]
352
352
if exists (x )
@@ -421,8 +421,8 @@ def load_plugins(sconf):
421
421
except Exception as error :
422
422
click .echo (
423
423
click .style ("[Plugin Error] " , fg = "red" )
424
- + "Couldn't load {0 }\n " . format ( plugin )
425
- + click .style ("{0}" . format ( error ) , fg = "yellow" )
424
+ + f "Couldn't load { plugin } \n "
425
+ + click .style (f" { error } " , fg = "yellow" )
426
426
)
427
427
sys .exit (1 )
428
428
@@ -985,7 +985,7 @@ def command_freeze(
985
985
save_to = os .path .abspath (
986
986
os .path .join (
987
987
get_config_dir (),
988
- "%s.%s" % (sconf .get ("session_name" ), config_format or "yaml" ),
988
+ "{}.{}" . format (sconf .get ("session_name" ), config_format or "yaml" ),
989
989
)
990
990
)
991
991
dest_prompt = click .prompt (
@@ -1135,7 +1135,6 @@ def command_load(
1135
1135
@cli .group (name = "import" )
1136
1136
def import_config_cmd ():
1137
1137
"""Import a teamocil/tmuxinator config."""
1138
- pass
1139
1138
1140
1139
1141
1140
def import_config (configfile , importfunc ):
@@ -1229,7 +1228,7 @@ def command_convert(confirmed, config):
1229
1228
to_filetype = "json"
1230
1229
else :
1231
1230
raise click .BadParameter (
1232
- "Unknown filetype: %s (valid: [.json, .yaml, .yml])" % ( ext ,)
1231
+ f "Unknown filetype: { ext } (valid: [.json, .yaml, .yml])"
1233
1232
)
1234
1233
1235
1234
configparser = kaptan .Kaptan ()
@@ -1240,7 +1239,7 @@ def command_convert(confirmed, config):
1240
1239
newconfig = configparser .export (to_filetype , indent = 2 , ** export_kwargs )
1241
1240
1242
1241
if not confirmed :
1243
- if click .confirm ("convert to <%s > to %s?" % ( config , to_filetype ) ):
1242
+ if click .confirm (f "convert to <{ config } > to { to_filetype } ?" ):
1244
1243
if click .confirm ("Save config to %s?" % newfile ):
1245
1244
confirmed = True
1246
1245
@@ -1260,9 +1259,7 @@ def command_edit_config(config):
1260
1259
call ([sys_editor , config ])
1261
1260
1262
1261
1263
- @cli .command (
1264
- name = "ls" , short_help = "List configured sessions in {}." .format (get_config_dir ())
1265
- )
1262
+ @cli .command (name = "ls" , short_help = f"List configured sessions in { get_config_dir ()} ." )
1266
1263
def command_ls ():
1267
1264
tmuxp_dir = get_config_dir ()
1268
1265
if os .path .exists (tmuxp_dir ) and os .path .isdir (tmuxp_dir ):
0 commit comments