Initial commit
This commit is contained in:
parent
c0536948b7
commit
0430546934
6
Makefile
Normal file
6
Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
install:
|
||||
chmod +x gitigrab
|
||||
cp gitigrab ${HOME}/.local/bin/gitigrab
|
||||
|
||||
uninstall:
|
||||
rm ${HOME}/.local/bin/gitigrab
|
14
README.md
14
README.md
@ -1,3 +1,15 @@
|
||||
# gitigrab
|
||||
|
||||
Quickly add .gitignore files to your projects.
|
||||
Helps you quickly add a gitignore file to your projects.
|
||||
|
||||
## Usage
|
||||
```sh
|
||||
$ gitigrab
|
||||
# Usage: gitigrab <template>
|
||||
|
||||
# Example 1: Add a Go gitignore file named `Go.gitignore`
|
||||
$ gitigrab go > Go.gitignore
|
||||
|
||||
# Example 2: Add a Python gitignore file named `.gitignore`
|
||||
$ gitigrab python
|
||||
```
|
||||
|
26
gitigrab
Executable file
26
gitigrab
Executable file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $(basename $0) <template>"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
DATA_DIR="$HOME/.local/share/gitigrab"
|
||||
|
||||
if [ ! -d "$DATA_DIR" ]; then
|
||||
git clone https://github.com/github/gitignore.git $DATA_DIR
|
||||
fi
|
||||
|
||||
CURRENT_DIR=$(pwd)
|
||||
|
||||
cd $DATA_DIR
|
||||
git pull -q
|
||||
|
||||
TEMPLATE=$(find . -type f -name "*.gitignore" | grep -iF $1 | head -n 1)
|
||||
|
||||
if [ -t 1 ]; then
|
||||
cp $TEMPLATE $CURRENT_DIR/.gitignore
|
||||
else
|
||||
cat $TEMPLATE
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user