Skip to content

Commit 98f711e

Browse files
committed
Code refactored, look at Changelog-21-06-11-03-2021.txt
1 parent 84f05ed commit 98f711e

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

CHANGELOGS/Changelog-21-06-11-03-2021.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
- Added possibility of updating project info
44
- Code refactored, added file:
55
- update.go
6-
- Readme.md updated
6+
- Readme.md updated
7+
- Error handling and added log about that work is done

prepareProject/jsonUpdate.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ package prepareProject
22

33
import (
44
"encoding/json"
5+
"github.com/fatih/color"
56
"godemon/errors"
67
"godemon/models"
78
"io/ioutil"
9+
os2 "os"
810
)
911

1012
func ModifyJSONCommands(option string, name string, path string) {
@@ -30,6 +32,8 @@ func ModifyJSONFiles(name string, path string) {
3032
errors.ErrorHandle(err)
3133
err = ioutil.WriteFile("project.json", file, 0644)
3234
errors.ErrorHandle(err)
35+
color.Green("Everything done, data updated")
36+
os2.Exit(1)
3337
}
3438

3539
func ModifyJSONVars(key string, value string) {
@@ -42,6 +46,8 @@ func ModifyJSONVars(key string, value string) {
4246
errors.ErrorHandle(err)
4347
err = ioutil.WriteFile("project.json", file, 0644)
4448
errors.ErrorHandle(err)
49+
color.Green("Everything done, data updated")
50+
os2.Exit(1)
4551
}
4652

4753
func ModifyJSONInfo(name string, os string, arch string, option string) {
@@ -57,4 +63,6 @@ func ModifyJSONInfo(name string, os string, arch string, option string) {
5763
errors.ErrorHandle(err)
5864
err = ioutil.WriteFile("project.json", file, 0644)
5965
errors.ErrorHandle(err)
66+
color.Green("Everything done, data updated")
67+
os2.Exit(1)
6068
}

updateInfo/update.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,11 @@ func Update(updateName bool, name string, updateArch bool, arch string, oso stri
3636
os.Exit(1)
3737
}
3838
prepareProject.ModifyJSONVars(key, value)
39-
os.Exit(1)
4039
}
4140
if addCmd == true {
4241
if name == "" || modOrFile == "" {
4342
color.Red("Name is empty or option isn't specified")
4443
}
4544
prepareProject.ModifyJSONCommands(modOrFile, name, filepath)
46-
os.Exit(1)
4745
}
4846
}

0 commit comments

Comments
 (0)