-
Notifications
You must be signed in to change notification settings - Fork 26
/
main.go
37 lines (32 loc) 路 855 Bytes
/
main.go
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
package main
import (
"flag"
"fmt"
"os"
"github.com/gowebly/gowebly/v2/cmd"
"github.com/gowebly/gowebly/v2/internal/helpers"
"github.com/gowebly/gowebly/v2/internal/messages"
"github.com/gowebly/gowebly/v2/internal/variables"
)
func main() {
// Parse flags.
flag.Parse()
// Run cmd with the parsed flags or exit with error.
if err := cmd.Run(flag.Args()); err != nil {
// Show error.
fmt.Println(helpers.MakeStyled(
messages.CommandErrorSummaryTitle,
&helpers.StringStyle{Color: variables.ColorRed, IsBold: true},
))
fmt.Println(helpers.MakeStyledFrame(
err.Error(),
&helpers.FrameStyle{Padding: []int{1}, Color: variables.ColorRed},
))
fmt.Println(helpers.MakeStyled(
messages.CommandMoreInformationTitle,
&helpers.StringStyle{Color: variables.ColorYellow},
))
// Stop with error code.
os.Exit(1)
}
}