mirror of
https://github.com/oSoWoSo/DistroHopper.git
synced 2024-08-14 22:46:53 +00:00
add function sort_functions
This commit is contained in:
parent
7882e1a003
commit
fc73efe0ca
1 changed files with 15 additions and 0 deletions
15
dh
15
dh
|
@ -379,6 +379,21 @@ function add_distro() {
|
||||||
meld "${TMP_DIR}/${NAME}.tmp $DH_CONFIG_DIR/quickget"
|
meld "${TMP_DIR}/${NAME}.tmp $DH_CONFIG_DIR/quickget"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sort_functions() {
|
||||||
|
# Get the name of the script from the command line argument
|
||||||
|
script_name=$1
|
||||||
|
# Get a list of all the function names in the script
|
||||||
|
function_names=$(grep -oP '^[[:space:]]*function \K\w+' "$script_name")
|
||||||
|
# Sort the function names alphabetically
|
||||||
|
sorted_function_names=$(echo "$function_names" | sort)
|
||||||
|
# Loop through the sorted function names and print the function definitions
|
||||||
|
for function_name in $sorted_function_names
|
||||||
|
do
|
||||||
|
# Print the function definition to stdout
|
||||||
|
grep -A $(wc -l < "$script_name") -w "function $function_name" "$script_name"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
function localization() {
|
function localization() {
|
||||||
# načtení souboru s lokalizací
|
# načtení souboru s lokalizací
|
||||||
. gettext.sh
|
. gettext.sh
|
||||||
|
|
Loading…
Reference in a new issue