init
This commit is contained in:
parent
976d3852fd
commit
34859d9a5b
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,4 +1,4 @@
|
|||||||
**.log
|
logs
|
||||||
/ddgo
|
ddgo
|
||||||
go.sum
|
go.sum
|
||||||
dist
|
dist
|
7
main.go
7
main.go
@ -82,7 +82,7 @@ func initLog() {
|
|||||||
|
|
||||||
err = log.NewFile(log.FileConfig{
|
err = log.NewFile(log.FileConfig{
|
||||||
Level: log.LevelInfo,
|
Level: log.LevelInfo,
|
||||||
Filename: "ddgo.log",
|
Filename: "./logs/ddgo.log",
|
||||||
FileRotationConfig: log.FileRotationConfig{
|
FileRotationConfig: log.FileRotationConfig{
|
||||||
Rotate: true,
|
Rotate: true,
|
||||||
Daily: true,
|
Daily: true,
|
||||||
@ -95,6 +95,10 @@ func initLog() {
|
|||||||
|
|
||||||
func parseArg() {
|
func parseArg() {
|
||||||
parser := flags.NewParser(&opts, flags.HelpFlag|flags.PassDoubleDash)
|
parser := flags.NewParser(&opts, flags.HelpFlag|flags.PassDoubleDash)
|
||||||
|
if AppName != "" {
|
||||||
|
parser.Name = AppName
|
||||||
|
}
|
||||||
|
|
||||||
if _, err := parser.Parse(); err != nil {
|
if _, err := parser.Parse(); err != nil {
|
||||||
if opts.Version {
|
if opts.Version {
|
||||||
printVersion()
|
printVersion()
|
||||||
@ -108,7 +112,6 @@ func parseArg() {
|
|||||||
|
|
||||||
_, _ = fmt.Fprintln(os.Stderr, err)
|
_, _ = fmt.Fprintln(os.Stderr, err)
|
||||||
|
|
||||||
parser.Name = AppName
|
|
||||||
parser.WriteHelp(os.Stderr)
|
parser.WriteHelp(os.Stderr)
|
||||||
|
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user