#!/bin/sh

# createjust template
if ! command -v -- sk >/dev/null 2>&1; then
  create_justfile_template() {
    cat <<'EOF' >justfile
# example justfile
# defines common tasks

# define variables
build_dir := "build"

# compile the project
build:
    @echo "Compiling the project..."
    mkdir -p build && cd build && cmake .. && make

# clean build artifacts
clean:
    @echo "Cleaning up..."
    rm -rf $build_dir

# run the project
run: build
    @echo "Running the project..."
    ./build/output

# default task
default: build
EOF
    echo "Template justfile created in the current directory."
  }
  # make the function a command by creating an alias
  alias createjust='create_justfile_template'
fi
