Skip to content

Commit

Permalink
✨ fix: cflag - get app name error, path.Base not support windows
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Oct 21, 2024
1 parent 21b0dcd commit a2decab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cflag/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"io"
"os"
"path"
"path/filepath"
"sort"

"github.com/gookit/color"
Expand Down Expand Up @@ -127,7 +127,8 @@ func (a *App) RunWithArgs(args []string) error {

func (a *App) init() {
if a.Name == "" {
a.Name = path.Base(os.Args[0])
// fix: path.Base not support windows
a.Name = filepath.Base(os.Args[0])
}
}

Expand Down

0 comments on commit a2decab

Please sign in to comment.