aboutsummaryrefslogtreecommitdiff
path: root/share/templater/git/setup
blob: 952e6ef911a5a699dc715e00b1d6db1307b38c9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
#
# Git templater module.
#

# Parameters
SHARE="$1"

# Include basic functions
source $SHARE/templater/functions || exit 1

# Git implementation
function templater_git {
  if [ ! -d ".git" ]; then
    templater_echo "Setting up git..."
    touch .gitignore

    templater_user_input GIT_USER  User             "-> Choose a git user name"
    templater_user_input GIT_EMAIL user@example.org "-> Choose a git email address"

    git init
    git config user.name  "$GIT_USER"
    git config user.email "$GIT_EMAIL"
    git add .
    git commit -m "Initial import"
  else
    templater_echo "Git already set"
  fi
}

# Dispatch
templater_git