@@ -18,6 +18,7 @@ import (
18
18
"github.com/essentialkaos/ek/v12/options"
19
19
"github.com/essentialkaos/ek/v12/support"
20
20
"github.com/essentialkaos/ek/v12/support/deps"
21
+ "github.com/essentialkaos/ek/v12/terminal"
21
22
"github.com/essentialkaos/ek/v12/terminal/tty"
22
23
"github.com/essentialkaos/ek/v12/usage"
23
24
"github.com/essentialkaos/ek/v12/usage/completion/bash"
@@ -36,7 +37,7 @@ import (
36
37
// Basic application info
37
38
const (
38
39
APP = "Jira Reindex Runner"
39
- VER = "0.0.6 "
40
+ VER = "0.1.0 "
40
41
DESC = "Tool for periodical running Jira re-index process"
41
42
)
42
43
@@ -81,24 +82,19 @@ var optMap = options.Map{
81
82
OPT_GENERATE_MAN : {Type : options .BOOL },
82
83
}
83
84
84
- // useRawOutput is raw output flag (for cli command)
85
- var useRawOutput = false
86
-
87
85
// ////////////////////////////////////////////////////////////////////////////////// //
88
86
89
87
// Run is main application function
90
88
func Run (gitRev string , gomod []byte ) {
91
89
preConfigureUI ()
92
90
93
- runtime .GOMAXPROCS (1 )
91
+ runtime .GOMAXPROCS (2 )
94
92
95
93
_ , errs := options .Parse (optMap )
96
94
97
- if len (errs ) != 0 {
98
- for _ , err := range errs {
99
- printError (err .Error ())
100
- }
101
-
95
+ if ! errs .IsEmpty () {
96
+ terminal .Error ("Options parsing errors:" )
97
+ terminal .Error (errs .String ())
102
98
os .Exit (1 )
103
99
}
104
100
@@ -183,10 +179,10 @@ func validateConfig() {
183
179
})
184
180
185
181
if len (errs ) != 0 {
186
- printError ("Error while configuration file validation:" )
182
+ terminal . Error ("Error while configuration file validation:" )
187
183
188
184
for _ , err := range errs {
189
- printError (" %v" , err )
185
+ terminal . Error (" %v" , err )
190
186
}
191
187
192
188
os .Exit (1 )
@@ -195,7 +191,7 @@ func validateConfig() {
195
191
196
192
// setupLogger configures logger subsystems
197
193
func setupLogger () {
198
- err := log .Set (knf .GetS (LOG_FILE ), knf .GetM (LOG_PERMS , 644 ))
194
+ err := log .Set (knf .GetS (LOG_FILE ), knf .GetM (LOG_PERMS , 0644 ))
199
195
200
196
if err != nil {
201
197
printErrorAndExit (err .Error ())
@@ -213,14 +209,9 @@ func process() {
213
209
os .Exit (runReindex ())
214
210
}
215
211
216
- // printError prints error message to console
217
- func printError (f string , a ... interface {}) {
218
- fmtc .Fprintf (os .Stderr , "{r}" + f + "{!}\n " , a ... )
219
- }
220
-
221
212
// printErrorAndExit print error message and exit with exit code 1
222
213
func printErrorAndExit (f string , a ... interface {}) {
223
- printError (f , a ... )
214
+ terminal . Error (f , a ... )
224
215
os .Exit (1 )
225
216
}
226
217
0 commit comments