Various Linux scripts.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

43 lines
747 B

#!/bin/bash
# Получение шаблона gitignore с сайта gitignore.io
ROOT=$(git root 2>&-)
TYPES=()
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-w|--write)
WRITE=1
shift
;;
*)
TYPES+=("$1")
shift
;;
esac
done
set -- "${TYPES[@]}"
if [ "${#TYPES[@]}" -gt 0 ]; then
for t in "${TYPES[@]}"; do
if [ -n "$WRITE" ] && [ -n "$ROOT" ]; then
echo "# $t"
curl -sq -L "https://gitignore.io/api/${t}" >> "$(git root)/.gitignore"
else
curl -sq -L "https://gitignore.io/api/${t}"
fi
done
if [ -n "$WRITE" ] && [ -n "$ROOT" ]; then
echo "Ignoring list saved to ${ROOT}/.gitignore file."
fi
else
echo "USAGE: $(basename "$0") [-w/--write] type1 type2 [...]"
exit 1
fi