@@ -4,42 +4,36 @@ import (
4
4
"fmt"
5
5
"io"
6
6
"os"
7
- "runtime"
8
7
)
9
8
10
9
func Install () {
11
10
12
- if runtime . GOOS == "linux" || runtime . GOOS == "darwin" {
11
+ Uninstall ()
13
12
14
- Uninstall ()
13
+ fmt .Println ("Install gitflow-toolkit" )
14
+ fmt .Println ("Create install home dir" )
15
+ CheckAndExit (os .MkdirAll (GitFlowToolKitHome , 0755 ))
15
16
16
- fmt .Println ("Install gitflow-toolkit" )
17
- fmt .Println ("Create install home dir" )
18
- CheckAndExit (os .MkdirAll (GitFlowToolKitHome , 0755 ))
17
+ fmt .Println ("Copy file to install home" )
18
+ currentFile , err := os .Open (CurrentPath )
19
+ CheckAndExit (err )
20
+ defer currentFile .Close ()
19
21
20
- fmt .Println ("Copy file to install home" )
21
- currentFile , err := os .Open (CurrentPath )
22
- defer currentFile .Close ()
23
- CheckAndExit (err )
22
+ installFile , err := os .OpenFile (InstallPath , os .O_CREATE | os .O_RDWR | os .O_TRUNC , 0755 )
23
+ CheckAndExit (err )
24
+ defer installFile .Close ()
24
25
25
- installFile , err := os .OpenFile (InstallPath , os .O_CREATE | os .O_RDWR | os .O_TRUNC , 0755 )
26
- defer installFile .Close ()
27
- CheckAndExit (err )
28
- _ , err = io .Copy (installFile , currentFile )
29
- CheckAndExit (err )
26
+ _ , err = io .Copy (installFile , currentFile )
27
+ CheckAndExit (err )
30
28
31
- fmt .Println ("Create symbolic file" )
32
- CheckAndExit (os .MkdirAll (HooksPath , 0755 ))
29
+ fmt .Println ("Create symbolic file" )
30
+ CheckAndExit (os .MkdirAll (HooksPath , 0755 ))
33
31
34
- for _ , binPath := range * BinPaths () {
35
- CheckAndExit (os .Symlink (InstallPath , binPath ))
36
- }
32
+ for _ , binPath := range * BinPaths () {
33
+ CheckAndExit (os .Symlink (InstallPath , binPath ))
34
+ }
37
35
38
- fmt .Println ("Config git" )
39
- MustExec ("git" , "config" , "--global" , "core.hooksPath" , HooksPath )
36
+ fmt .Println ("Config git" )
37
+ MustExec ("git" , "config" , "--global" , "core.hooksPath" , HooksPath )
40
38
41
- } else {
42
- fmt .Println ("Platform not support!" )
43
- os .Exit (1 )
44
- }
45
39
}
0 commit comments