mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-01 20:28:16 +02:00
Add a structured way to install a hook
This commit is contained in:
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Install a hook into ~/.config/omarchy/hooks/<type>.d/
|
||||
# omarchy:group=hook
|
||||
# omarchy:name=install
|
||||
# omarchy:args=<type> <file>
|
||||
# omarchy:examples=omarchy hook install post-update ~/my-hook
|
||||
|
||||
set -e
|
||||
|
||||
if (( $# != 2 )); then
|
||||
echo "Usage: omarchy-hook-install <type> <file>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
HOOK_TYPE=$1
|
||||
HOOK_FILE=$2
|
||||
HOOK_DIR="$HOME/.config/omarchy/hooks/$HOOK_TYPE.d"
|
||||
HOOK_NAME=$(basename "$HOOK_FILE")
|
||||
HOOK_PATH="$HOOK_DIR/$HOOK_NAME"
|
||||
|
||||
if [[ ! -f $HOOK_FILE ]]; then
|
||||
echo "Hook file not found: $HOOK_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$HOOK_DIR"
|
||||
cp "$HOOK_FILE" "$HOOK_PATH"
|
||||
chmod 755 "$HOOK_PATH"
|
||||
|
||||
echo "Installed $HOOK_TYPE hook: $HOOK_PATH"
|
||||
Reference in New Issue
Block a user