diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2017-10-28 10:27:04 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2017-10-28 10:27:04 -0200 |
commit | 26e2367c6b340f324d945a58dc7811fcf3367380 (patch) | |
tree | 8dac77ed6dca956661590dd1dd06a6b28fee0f3d /templater | |
parent | 3566ebf9440c7df15c8b965dab027a6b98df6c74 (diff) | |
download | templater-26e2367c6b340f324d945a58dc7811fcf3367380.tar.gz templater-26e2367c6b340f324d945a58dc7811fcf3367380.tar.bz2 |
Ask for basic git config and commit the initial repository
Diffstat (limited to 'templater')
-rwxr-xr-x | templater | 27 |
1 files changed, 26 insertions, 1 deletions
@@ -70,6 +70,26 @@ function __templater_copy_or_append { fi } +# Read a parameter from user +function __templater_user_input { + local input + local param="$1" + local default="$2" + shift 2 + + if echo $param | grep -q 'passwd'; then + read -s -rep "$* (defaults to $default): " input + else + read -rep "$* (defaults to $default): " input + fi + + if [ -z "$input" ]; then + export $param="$default" + else + export $param="$input" + fi +} + # Basic implementation function templater_basic { if [ ! -e "README.md" ]; then @@ -95,9 +115,14 @@ function templater_git { __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" + git commit -m "Initial import" else __templater_echo "Git already set" fi |