1- # -*- coding: utf-8 -*-
2-
31import hashlib
42import inspect
53import os
@@ -118,7 +116,7 @@ def handle(self): # type: () -> int
118116 return 0
119117
120118 def render (self , shell ): # type: (str) -> str
121- return getattr (self , "render_{}" . format ( shell ) )()
119+ return getattr (self , f "render_{ shell } " )()
122120
123121 def render_bash (self ): # type: () -> str
124122 template = TEMPLATES ["bash" ]
@@ -161,10 +159,7 @@ def render_bash(self): # type: () -> str
161159 commands_options [command .name ] = command_options
162160
163161 compdefs = "\n " .join (
164- [
165- "complete -o default -F {} {}" .format (function , alias )
166- for alias in aliases
167- ]
162+ [f"complete -o default -F { function } { alias } " for alias in aliases ]
168163 )
169164
170165 commands = sorted (commands )
@@ -176,7 +171,7 @@ def render_bash(self): # type: () -> str
176171 options = [self ._zsh_describe (opt , None ).strip ('"' ) for opt in options ]
177172
178173 desc = [
179- " ({})" . format ( command ) ,
174+ f " ({ command } )" ,
180175 ' opts="${{opts}} {}"' .format (" " .join (options )),
181176 " ;;" ,
182177 ]
@@ -245,9 +240,7 @@ def render_zsh(self):
245240
246241 commands_options [command .name ] = command_options
247242
248- compdefs = "\n " .join (
249- ["compdef {} {}" .format (function , alias ) for alias in aliases ]
250- )
243+ compdefs = "\n " .join ([f"compdef { function } { alias } " for alias in aliases ])
251244
252245 commands = sorted (commands_options .keys ())
253246 command_list = []
@@ -260,7 +253,7 @@ def render_zsh(self):
260253 ]
261254
262255 desc = [
263- " ({})" . format ( command ) ,
256+ f " ({ command } )" ,
264257 " opts+=({})" .format (" " .join (options )),
265258 " ;;" ,
266259 ]
@@ -359,7 +352,7 @@ def render_fish(self):
359352 )
360353 )
361354
362- cmds_opts += ["# {}" . format ( cmd ) ]
355+ cmds_opts += [f "# { cmd } " ]
363356 options = set (commands_options [cmd ]).difference (global_options )
364357 options = sorted (options )
365358
0 commit comments