Improve language

This commit is contained in:
Thomas Kuschel 2024-06-17 20:59:16 +02:00
parent fab3edc45a
commit ce67b2f5ba
2 changed files with 12 additions and 18 deletions

View File

@ -119,11 +119,7 @@ def replace_substring_with_line(path, search_substring, verbose=0):
for line in replace_substring_with_line.lines: for line in replace_substring_with_line.lines:
if search_substring[0:46].lower() in line.lower(): if search_substring[0:46].lower() in line.lower():
modified_line = line.strip() return line.strip()
# Replace the substring with the whole line
## line = line.lower().replace(search_substring.lower(), modified_line)
modified_line = line
return modified_line
except FileNotFoundError: except FileNotFoundError:
print(f'The file {path} was not found.') print(f'The file {path} was not found.')
@ -233,7 +229,7 @@ def fix_typo(call, fullname, verbose=1):
fix_typo.spaces = [line.index(words[1]), line.index(words[2]), line.index(words[3])] fix_typo.spaces = [line.index(words[1]), line.index(words[2]), line.index(words[3])]
else: else:
if call in line[2:8]: if call in line[2:8]:
if verbose > 0: if verbose > 1:
print(f'Call: {call} found') print(f'Call: {call} found')
match line[0]: match line[0]:
case '#': case '#':
@ -241,8 +237,8 @@ def fix_typo(call, fullname, verbose=1):
print(line.rstrip()) print(line.rstrip())
case 'F': case 'F':
if verbose > 0: if verbose > 0:
print(fullname)
print(line.rstrip()) print(line.rstrip())
print(fullname)
firstname1, surname1, gender1 = call_split_name(fullname, call, 0) firstname1, surname1, gender1 = call_split_name(fullname, call, 0)
fullname2 = line[fix_typo.spaces[1]:fix_typo.spaces[2]-1].rstrip() + ' ' + line[fix_typo.spaces[2]:-1] fullname2 = line[fix_typo.spaces[1]:fix_typo.spaces[2]-1].rstrip() + ' ' + line[fix_typo.spaces[2]:-1]
if verbose > 0: if verbose > 0:
@ -262,8 +258,8 @@ def fix_typo(call, fullname, verbose=1):
fullname = fullname2 fullname = fullname2
case 'X': # exchange the surname with firstname case 'X': # exchange the surname with firstname
if verbose > 0: if verbose > 0:
print(fullname)
print(line.rstrip()) print(line.rstrip())
print(fullname)
firstname1, surname1, gender1 = call_split_name(fullname, call, 0) firstname1, surname1, gender1 = call_split_name(fullname, call, 0)
fullname2 = line[fix_typo.spaces[1]:fix_typo.spaces[2]-1].rstrip() + ' ' + line[fix_typo.spaces[2]:-1] fullname2 = line[fix_typo.spaces[1]:fix_typo.spaces[2]-1].rstrip() + ' ' + line[fix_typo.spaces[2]:-1]
if verbose > 0: if verbose > 0:

View File

@ -2,7 +2,7 @@
# Script Updating Gitea (c) Thomas Kuschel # Script Updating Gitea (c) Thomas Kuschel
# since 2024 # since 2024
echo "Update the Gitea from the website and restart Gitea Service" echo "Update the Gitea from the website and restart Gitea service"
website_latest="https://github.com/go-gitea/gitea/releases/latest" website_latest="https://github.com/go-gitea/gitea/releases/latest"
website_uri="https://dl.gitea.io/gitea" website_uri="https://dl.gitea.io/gitea"
@ -24,15 +24,15 @@ fi
version_active_raw=$( gitea --version ) version_active_raw=$( gitea --version )
version_active=$( gitea --version | awk '{ print $3; exit }' ) version_active=$( gitea --version | awk '{ print $3; exit }' )
echo "Website Version: ${version}" echo "Website version: ${version}"
echo " Active Version: ${version_active}" echo " Active version: ${version_active}"
if [ "${version}" == "${version_active}" ] if [ "${version}" == "${version_active}" ]
then then
echo "Both Version Strings are Equal." echo "Both version strings are the same."
else else
echo "Both Version Strings are not Equal." echo "There are differnces between the two version strings."
echo "Start Updating..." echo "Start updating..."
read -p "Are you sure? (y/N)" -n 1 -r read -p "Are you sure? (y/N)" -n 1 -r
echo # (optional) move to a new line echo # (optional) move to a new line
if [[ $REPLY =~ ^[YyJj]$ ]] if [[ $REPLY =~ ^[YyJj]$ ]]
@ -56,9 +56,7 @@ else
fi fi
# remove local files: # remove local files:
rm gitea gitea.sha256 rm gitea gitea.sha256
fi fi
fi fi
#echo active gitea version: #echo active gitea version:
@ -69,5 +67,5 @@ read -p "Restart the gitea service on the host? (y/N)" -n 1 -r
if [[ $REPLY =~ ^[YyJj]$ ]] if [[ $REPLY =~ ^[YyJj]$ ]]
then then
sudo systemctl restart gitea.service sudo systemctl restart gitea.service
echo "Restarted gitea.service" echo "gitea.service restarted."
fi fi