-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevFunction
More file actions
96 lines (79 loc) · 1.77 KB
/
devFunction
File metadata and controls
96 lines (79 loc) · 1.77 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
dev(){
EMACSDIR='/usr/share/emacs23'
#Comment and uncomment as needed
EDITOR='emacs'
#EDITOR='vim'
#EDITOR='vi'
#EDITOR='nano'
#EDITOR='pico'
#Check if emacs is the editor and if it is installed
if [ $EDITOR == 'emacs' ]
then
if [ ! -d "$EMACSDIR" ]
then
echo "Installing emacs..."
sleep 2
sudo apt-get install emacs23-nox -y
fi
fi
#Is this a new file?
if [ -f $1 ]
then
$EDITOR $1
else
#Lets check what kind of file was it
case $1 in
*.sh | *.bash)
touch $1
cat $HOME/.Dev/bash.sh > $1
chmod +x $1
$EDITOR $1
;;
*.py)
touch $1
cat $HOME/.Dev/py.py > $1
chmod +x $1
$EDITOR $1
;;
*.c)
touch $1
cat $HOME/.Dev/c.c > $1
$EDITOR $1
;;
*.c++ | *.cpp)
touch $1
cat $HOME/.Dev/cpp.c++ > $1
$EDITOR $1
;;
*.java)
touch $1
cat $HOME/.Dev/java.java > $1
readonly CLASSNAME="$1" #Removes the last 5 chars
sed -i s'/\/\*\File_Name_Here\*\//'${CLASSNAME::-5}' /'g $1
$EDITOR $1
;;
*.html)
touch $1
cat $HOME/.Dev/html.html > $1
$EDITOR $1
;;
#Kinda like a 'man page'
"dev")
echo -e " "
echo -e " If you're having issues with the dev command"
echo -e " \tnavigate to: $HOME/.Dev/ and use: make run"
echo -e " If that doesnt solve your proble, try building"
echo -e " \tit from scratch by using:"
echo -e " \tgit clone https://github.com/J-O-R-G-E/dev.git"
echo -e " Navigate to that directory, dev, again and use:"
echo -e " \tmake clean"
echo -e " \tmake"
echo -e " \tmake run\n"
;;
*)
$EDITOR $1
;;
esac
fi
}