1
Fork 0
mirror of https://github.com/Steffo99/config-fish.git synced 2024-12-22 14:54:23 +00:00

more stuff

This commit is contained in:
Steffo 2024-08-21 21:59:02 +02:00
parent 21b424f329
commit 500448b331
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
15 changed files with 79 additions and 61 deletions

View file

@ -1,6 +1,7 @@
which btm --skip-functions >/dev/null 2>/dev/null
if [ $status -eq 0 ]
function btm --wraps="btm"
log-t "Running" "btm" "with the GPU memory display enabled..."
command btm --enable_gpu_memory $argv;
end
end

View file

@ -1,6 +1,7 @@
which clear --skip-functions >/dev/null 2>/dev/null
if [ $status -eq 0 ]
function cls --wraps="clear"
log-t "" "Clearing" "the screen..."
command clear $argv
end
end

View file

@ -1,4 +1,5 @@
function confirm
log-t "Asking for a" "confirmation" "..."
set -g ANSWER (read -n 1 -P "Confirm? (y/N) ")
if test -z $ANSWER

View file

@ -1,6 +1,7 @@
which cp --skip-functions >/dev/null 2>/dev/null
if [ $status -eq 0 ]
function cp --wraps="cp"
log-t "Performing a" "safe copy" "..."
command cp --interactive --verbose $argv;
end
end

View file

@ -1,38 +1,42 @@
function dotfish
log-i "Running" "dotfish" "update..."
if test (count $argv) -eq 0
set -g argv (whoami)
log-d "No users specified, running on" "$argv" ""
end
for TARGET in $argv
log-d "Updating fish config for:" "$TARGET" ""
set -g FISHCONFIG ~(echo $TARGET)/.config/fish
log-d "Destination directory is:" "$FISHCONFIG" ""
log-t "Destination directory is:" "$FISHCONFIG" ""
if not test -e "$FISHCONFIG/.DOTFISHED"
log-w "Conflicting config detected" "$FISHCONFIG" ", delete?"
if confirm
log-d "Deleting old config at" "$FISHCONFIG" "..."
log-t "Deleting old config at" "$FISHCONFIG" "..."
command rm -rf "$FISHCONFIG"
else
log-d "Deletion rejected, not touching" "$FISHCONFIG" "..."
log-t "Deletion rejected, not touching" "$FISHCONFIG" "."
continue
end
end
if test -d "$FISHCONFIG"
log-d "Existing config detected at" "$FISHCONFIG" "pulling from Git..."
log-t "Existing config detected at" "$FISHCONFIG" "pulling from Git..."
command git -C "$FISHCONFIG" pull
else
log-d "No config detected, cloning from Git into" "$FISHCONFIG" "..."
log-t "No config detected, cloning from Git into" "$FISHCONFIG" "..."
command git clone "https://github.com/Steffo99/.config-fish" "$FISHCONFIG"
end
log-d "Fixing permissions at" "$FISHCONFIG" "..."
log-t "Fixing permissions at" "$FISHCONFIG" "..."
command chown -R "$TARGET:" "$FISHCONFIG"
log-d "Changing login shell to" "/usr/bin/fish" "..."
log-t "Changing login shell to" "/usr/bin/fish" "..."
command chsh -s "/usr/bin/fish" "$TARGET"
log-s "" "Dotfish" "updated successfully!"
end
log-s "Dotfish updated successfully for" "$argv" "!"
end

View file

@ -1,6 +1,7 @@
which sudo --skip-functions >/dev/null 2>/dev/null
if [ $status -eq 0 ]
function dudo --wraps="sudo"
log-t "just do as" "superuser" ", bro"
command sudo $argv
end
end

View file

@ -1,9 +1,9 @@
which magick --skip-functions >/dev/null 2>/dev/null
if [ $status -eq 0 ]
function emoji-akkoma --wraps=magick
log-d "Creating" "Akkoma" "directory..."
log-t "Creating" "Akkoma" "directory..."
command mkdir --parents "Akkoma"
log-d "Processing" "$argv[1]" "..."
log-t "Processing" "$argv[1]" "..."
command magick -background none "$argv[1]" -resize "106x106^" -gravity center -extent 106x106 $argv[2..-1] "Akkoma/$argv[1]"
log-s "Done! Emojis added to the " "Akkoma" "directory!"
end

View file

@ -1,9 +1,9 @@
which magick --skip-functions >/dev/null 2>/dev/null
if [ $status -eq 0 ]
function emoji-discord --wraps=magick
log-d "Creating" "Discord" "directory..."
log-t "Creating" "Discord" "directory..."
command mkdir --parents "Discord"
log-d "Processing" "$argv[1]" "..."
log-t "Processing" "$argv[1]" "..."
command magick -background none "$argv[1]" -resize "106x106^" -gravity center -extent 128x128 $argv[2..-1] "Discord/$argv[1]"
log-s "Done! Emojis added to the " "Discord" "directory!"
end

View file

@ -1,9 +1,9 @@
which magick --skip-functions >/dev/null 2>/dev/null
if [ $status -eq 0 ]
function emoji-telegram --wraps=magick
log-d "Creating" "Telegram" "directory..."
log-t "Creating" "Telegram" "directory..."
command mkdir --parents "Telegram"
log-d "Processing" "$argv[1]" "..."
log-t "Processing" "$argv[1]" "..."
command magick -background none "$argv[1]" -resize "100x100^" -gravity center -extent 128x128 $argv[2..-1] "Telegram/$argv[1]"
log-s "Done! Emojis added to the " "Telegram" "directory!"
end

View file

@ -1,6 +1,7 @@
which ls --skip-functions >/dev/null 2>/dev/null
if [ $status -eq 0 ]
function ll --wraps=ls
log-t "" "Listing" "all files in the directory..."
command ls --all --author --color --kibibytes --human-readable -l $argv;
end
end

View file

@ -1,9 +1,9 @@
function log-demo
log-t "This is a" "TRACE (60)" "log."
log-d "This is a" "DEBUG (50)" "log."
log-i "This is a" "INFORMATION (40)" "log."
log-s "This is a" "SUCCESS (30)" "log."
log-w "This is a" "WARNING (20)" "log."
log-e "This is a" "ERROR (10)" "log."
log-f "This is a" "FATAL (0)" "log."
log-t "This is a" "[t]race (60)" "log."
log-d "This is a" "[d]ebug (50)" "log."
log-i "This is a" "[i]nformation (40)" "log."
log-s "This is a" "[s]uccess (30)" "log."
log-w "This is a" "[w]arning (20)" "log."
log-e "This is a" "[e]rror (10)" "log."
log-f "This is a" "[f]atal (0)" "log."
end

View file

@ -1,6 +1,7 @@
which ls --skip-functions >/dev/null 2>/dev/null
if [ $status -eq 0 ]
function mv --wraps="mv"
log-t "Performing a" "safe move" "..."
command mv --interactive --verbose $argv;
end
end

View file

@ -1,21 +1,24 @@
which docker --skip-functions >/dev/null 2>/dev/null
if [ $status -eq 0 ]
if [ $status -eq 0 ]
function redocker
set project (docker compose config --format json | jq --raw-output .name)
log-i "Re-instantiating" "$project" "..."
log-d "Pulling images used by " "$project" "..."
log-t "Pulling images used by " "$project" "..."
command docker compose pull
log-d "Building images using by " "$project" "..."
log-t "Building images using by " "$project" "..."
command docker compose build
echo_progress "Taking down " "$project" "..."
log-t "Taking down " "$project" "..."
command docker compose down
echo_progress "Bringing up " "$project" "..."
log-t "Bringing up " "$project" "..."
command docker compose up -d
echo_progress "Opening logs of " "$project" "..."
log-s "Re-instantiated" "$project" "!"
log-t "Opening logs of " "$project" "..."
command docker compose logs -f
end
end

View file

@ -1,6 +1,7 @@
which rm --skip-functions >/dev/null 2>/dev/null
if [ $status -eq 0 ]
function rm --wraps="rm"
log-t "Performing a" "safe delete" "..."
command rm --interactive="always" $argv
end
end

View file

@ -1,3 +1,6 @@
function telegram-video
which docker --skip-functions >/dev/null 2>/dev/null
if [ $status -eq 0 ]
function video-telegram
ffmpeg -i "$argv[1]" -filter:v 'scale=480:-1' -c:v 'h264_nvenc' -c:a 'copy' -crf '29' "$argv[1].crf29.mp4"
end
end