replace .format with fstring

This commit is contained in:
Isaac 2023-05-04 13:39:48 -07:00
parent f04036e4a7
commit 700f8e9d9c
No known key found for this signature in database
GPG key ID: E69FB5A841448A48

View file

@ -39,13 +39,11 @@ def bash_completion():
' local this_script="$(cat "$BASH_SOURCE" 2> /dev/null)"', ' local this_script="$(cat "$BASH_SOURCE" 2> /dev/null)"',
' local installed_script="$(borgmatic --bash-completion 2> /dev/null)"', ' local installed_script="$(borgmatic --bash-completion 2> /dev/null)"',
' if [ "$this_script" != "$installed_script" ] && [ "$installed_script" != "" ];' ' if [ "$this_script" != "$installed_script" ] && [ "$installed_script" != "" ];'
' then cat << EOF\n{}\nEOF'.format( f''' then cat << EOF\n{upgrade_message(
upgrade_message(
'bash', 'bash',
'sudo sh -c "borgmatic --bash-completion > $BASH_SOURCE"', 'sudo sh -c "borgmatic --bash-completion > $BASH_SOURCE"',
'$BASH_SOURCE', '$BASH_SOURCE',
) )}\nEOF''',
),
' fi', ' fi',
'}', '}',
'complete_borgmatic() {', 'complete_borgmatic() {',
@ -95,13 +93,11 @@ def fish_completion():
' set this_script (cat $this_filename 2> /dev/null)', ' set this_script (cat $this_filename 2> /dev/null)',
' set installed_script (borgmatic --fish-completion 2> /dev/null)', ' set installed_script (borgmatic --fish-completion 2> /dev/null)',
' if [ "$this_script" != "$installed_script" ] && [ "$installed_script" != "" ]', ' if [ "$this_script" != "$installed_script" ] && [ "$installed_script" != "" ]',
' echo "{}"'.format( f''' echo "{upgrade_message(
upgrade_message(
'fish', 'fish',
'borgmatic --fish-completion | sudo tee $this_filename', 'borgmatic --fish-completion | sudo tee $this_filename',
'$this_filename', '$this_filename',
) )}"''',
),
' end', ' end',
'end', 'end',
'__borgmatic_check_version &', '__borgmatic_check_version &',