-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpnewgo
More file actions
executable file
·36 lines (30 loc) · 988 Bytes
/
pnewgo
File metadata and controls
executable file
·36 lines (30 loc) · 988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
RED="\e[31m"
NOCOLOR="\e[0m"
CYAN="\e[36m"
if [ -z $1 ]
then
echo "Name of GO package: "
read name
else
name=$1
fi
if [ -d $name ]
then
echo -e "${RED}Package already exists! ($name)"
else
echo -e "[$name] ${CYAN} Creating package: Starting${NOCOLOR}"
echo -e "[$name] ${CYAN} Creating directory${NOCOLOR}"
mkdir $name
echo -e "[$name] ${CYAN} Entering directory${NOCOLOR}"
cd $name
echo -e "[$name] ${CYAN} Initializing git${NOCOLOR}"
git init
echo 'package main
import "fmt"
func main() {
fmt.Printf("Hello, go!\n")
}' > main.go
touch go
echo -e "[$name] ${CYAN} Creating package: Done${NOCOLOR}"
fi