forked from ahurac/dotfiles
Légère réécriture de updateall
This commit is contained in:
parent
9367fef8e9
commit
0b0cd477c5
1 changed files with 8 additions and 6 deletions
|
@ -1,24 +1,26 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Variable
|
||||
commands_d="$HOME/.local/share/updateall/commands.d"
|
||||
commands_d="${HOME}/.local/share/updateall/commands.d"
|
||||
|
||||
# Function
|
||||
# Create a clear separator, adapts to the screen size
|
||||
function separator {
|
||||
local char="${2:-=}"
|
||||
local separator cols
|
||||
local separator=""
|
||||
|
||||
local name="$1" ; shift
|
||||
local char="${1:-=}"; shift
|
||||
(( cols = $(tput cols) / 3 ))
|
||||
|
||||
while [[ ${#separator} -le $cols ]]; do
|
||||
while [[ ${#separator} -le "$cols" ]]; do
|
||||
separator+="$char"
|
||||
done
|
||||
|
||||
printf '\n%s\n\t%s\n%s\n' "$separator" "$1" "$separator"
|
||||
printf '\n%s\n\t%s\n%s\n' "$separator" "$name" "$separator"
|
||||
}
|
||||
|
||||
# Loop
|
||||
for pm in "$commands_d/"*; do
|
||||
for pm in "${commands_d}/"*; do
|
||||
separator "$(basename "$pm")"
|
||||
source "$pm"
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue