feat: formatter

This commit is contained in:
hesam-init 2024-06-29 16:05:09 +03:30
parent bf9e720177
commit 9cca7e76c2
3 changed files with 359 additions and 319 deletions

View file

@ -4,15 +4,15 @@
@import "./assets/scss/windows/vbar.scss"; @import "./assets/scss/windows/vbar.scss";
@import "./assets/src/control-panel/styles.scss"; @import "./src/control-panel/styles.scss";
@import "./assets/src/dashboard/styles.scss"; @import "./src/dashboard/styles.scss";
@import "./assets/src/dock/styles.scss"; @import "./src/dock/styles.scss";
@import "./assets/src/desktop/styles.scss"; @import "./src/desktop/styles.scss";
@import "./assets/src/notification/styles.scss"; @import "./src/notification/styles.scss";
* { * {
all: unset; all: unset;

View file

@ -1 +1,41 @@
echo "Shit" #!/bin/bash
WATCH_DIR="$(pwd)"
if [ -z "$WATCH_DIR" ]; then
echo "Usage: $0 <directory>"
exit 1
fi
if [ ! -d "$WATCH_DIR" ]; then
echo "Directory $WATCH_DIR does not exist."
exit 1
fi
format_file() {
local file="$1"
echo "Formatting $file"
vim -E -s "$file" <<EOF
:source /path/to/your/yuck.vim
:filetype plugin indent on
:set filetype=yuck
:normal gg=G
:wq
EOF
}
last_run=0
inotifywait -m -r -e modify,create,delete,move --format '%w%f' "$WATCH_DIR" | while read -r file; do
if [[ "$file" == *.yuck ]]; then
current_time=$(date +%s%N | cut -b1-13)
if ((current_time - last_run > 500)); then
sleep 0.1
if [ -e "$file" ]; then
format_file $file
fi
last_run=$current_time
fi
fi
done