<commit_before>#!/bin/bash

set -e
set -o pipefail

# Author: <NAME> <<EMAIL>>
# License: MIT (licenses/holman-dotfiles.md)
info () {
	printf "\r  [ \033[00;34m..\033[0m ] $1\n"
}

# Author: <NAME> <<EMAIL>>
# License: MIT (licenses/holman-dotfiles.md)
user () {
	printf "\r  [ \033[0;33m??\033[0m ] $1\n"
}

# Author: <NAME> <<EMAIL>>
# License: MIT (licenses/holman-dotfiles.md)
success () {
	printf "\r\033[2K  [ \033[00;32mOK\033[0m ] $1\n"
}

# Author: <NAME> <<EMAIL>>
# Modifications: <NAME> <<EMAIL>>
# - Exit with non zero status code
# License: MIT (licenses/holman-dotfiles.md) and MIT (LICENSE) for modifications
fail () {
	printf "\r\033[2K  [\033[0;31mFAIL\033[0m] $1\n"
	echo ''
	exit 1
}

if [ -z "$DOTFILES_HOME" ]; then
	DOTFILES_HOME="$HOME/.dotfiles"
fi

mkdir -p $DOTFILES_HOME

info "installing dotfiles in $DOTFILES_HOME"

hash curl 2>/dev/null || { fail >&2 "curl is not installed, please install it"; }

releaseUrl=$(curl -s https://api.github.com/repos/ahaasler/dotfiles/releases | grep browser_download_url | head -n 1 | cut -d '"' -f 4)
info "downloading latest release: $releaseUrl"
curl -skL $releaseUrl | tar zx --strip-components 1 -C $DOTFILES_HOME

$DOTFILES_HOME/script/setup.sh<commit_msg>Add git download alternative in get script<commit_after>#!/bin/bash

set -e
set -o pipefail

# Author: <NAME> <<EMAIL>>
# License: MIT (licenses/holman-dotfiles.md)
info () {
	printf "\r  [ \033[00;34m..\033[0m ] $1\n"
}

# Author: <NAME> <<EMAIL>>
# License: MIT (licenses/holman-dotfiles.md)
user () {
	printf "\r  [ \033[0;33m??\033[0m ] $1\n"
}

# Author: <NAME> <<EMAIL>>
# License: MIT (licenses/holman-dotfiles.md)
success () {
	printf "\r\033[2K  [ \033[00;32mOK\033[0m ] $1\n"
}

# Author: <NAME> <<EMAIL>>
# Modifications: <NAME> <<EMAIL>>
# - Exit with non zero status code
# License: MIT (licenses/holman-dotfiles.md) and MIT (LICENSE) for modifications
fail () {
	printf "\r\033[2K  [\033[0;31mFAIL\033[0m] $1\n"
	echo ''
	exit 1
}

if [ -z "$DOTFILES_HOME" ]; then
	DOTFILES_HOME="$HOME/.dotfiles"
fi

mkdir -p $DOTFILES_HOME

info "installing dotfiles in $DOTFILES_HOME"

if hash git 2>/dev/null; then
	info "installing with git"
	rm -rf $DOTFILES_HOME
	git clone --recursive https://github.com/ahaasler/dotfiles.git $DOTFILES_HOME &>/dev/null
else
	hash curl 2>/dev/null || { fail >&2 "curl is not installed, please install it"; }
	info "intalling with curl"
	releaseUrl=$(curl -s https://api.github.com/repos/ahaasler/dotfiles/releases | grep browser_download_url | head -n 1 | cut -d '"' -f 4)
	info "downloading latest release: $releaseUrl"
	curl -skL $releaseUrl | tar zx --strip-components 1 -C $DOTFILES_HOME
fi

success "downloaded dotfiles"

$DOTFILES_HOME/script/setup.sh
{'fraction_non_alphanumeric': 0.1749356854097758, 'fraction_numerical': 0.04446894524072032, 'mean_word_length': 4.012891344383057, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 39, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '709870', 'n_tokens_mistral': 1163, 'n_tokens_neox': 1074, 'n_words': 272}