Files
git.taskfile.build/bin/create-symlink-files
T
Janik von Rotz 5eb4eb0367 feat(task): add task template with help table and command sourcing
- Introduce `task.template` file with structured help table for all available commands
- Implement dynamic command sourcing from `$HOME/taskfile.build/bin` directory
- Add support for searching help entries with optional argument in `help` function
- Include comprehensive listing of file, environment, LLM, Git, Pass, KeePass, and Docker commands
- Maintain consistent code style and formatting across the template file
2025-11-26 08:12:01 +01:00

26 lines
729 B
Bash
Executable File

#!/usr/bin/env bash
create-symlink-files() {
local source_pattern="$1"
local target_dir="$2"
# Create target directory
ensure-directory "$target_dir"
# Link each file in the source pattern
for source_file in $source_pattern; do
if [[ -f "$source_file" ]]; then
local filename=$(basename "$source_file")
local target_file="$target_dir/$filename"
# Remove existing file if it exists
if [[ -e "$target_file" || -L "$target_file" ]]; then
rm -f "$target_file"
fi
# Create the symlink
echo "Link $source_file to $target_file."
ln -sf "$source_file" "$target_file"
fi
done
}