3rd / templates

Personal project templates.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Templates for projects & sandboxes

TypeScript:

Scripts

tpl.sh
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'

# paths
CWD=$PWD
TEMPLATES_DIR=~/templates

pick_template() {
cd "$TEMPLATES_DIR"
fd . -td -d 1 | fzf
}

main() {
    # select template
    local selected_template source destination
    selected_template=$(pick_template)
    if [[ -z "$selected_template" ]]; then
    exit
    fi
    source="$TEMPLATES_DIR/$selected_template"
    echo "Source: $source"

    # select destination
    echo -n 'Destination: '
    read -i "$CWD/" -e -r destination

    # apply
    if [ -d "$destination" ]; then
    cp -r "$source""/*" "$destination"
    else
    cp -r "$source" "$destination"
    fi
    git init
}

main

About

Personal project templates.


Languages

Language:TypeScript 52.1%Language:JavaScript 18.6%Language:HTML 9.0%Language:Makefile 7.9%Language:CSS 6.3%Language:Go 3.9%Language:Shell 1.6%Language:Nix 0.5%