# Install Editorconfig file (with tabs) in current directory.
function bootstrap_editorconfig() {
	echo "\
[*]
end_of_line = lf
charset = utf-8
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true
" > .editorconfig
}

# Install Editorconfig file (with specified spaces, 8 by default) in current directory.
# Usage: bootstrap_editorconfig_space [AMOUNT]
function bootstrap_editorconfig_space() {
	local spaces="${1}"
	[[ "${spaces}" = "" ]] && spaces=8

	echo "\
[*]
end_of_line = lf
charset = utf-8
indent_style = space
indent_size = ${spaces}
insert_final_newline = true
trim_trailing_whitespace = true
" > .editorconfig
}

# Setup all the flatpak apps on the machine.
function bootstrap_flatpak() {
	# Add Flathub repo.
	flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo

	# Reinstall apps.
	local IFS=$'\n'
	local targets="$(cat ~/.config/linux/Flatpak.txt | cut -f2)"

	process() {
		flatpak install -y --system "${target}"
	}

	_iterate_targets process ${targets[@]}
}