Merge pull request #312 from ysh7/master
use path.Base in Name & HelpName as default values
This commit is contained in:
commit
8eb7738f18
7
app.go
7
app.go
@ -5,13 +5,14 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"path"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// App is the main structure of a cli application. It is recomended that
|
// App is the main structure of a cli application. It is recomended that
|
||||||
// an app be created with the cli.NewApp() function
|
// an app be created with the cli.NewApp() function
|
||||||
type App struct {
|
type App struct {
|
||||||
// The name of the program. Defaults to os.Args[0]
|
// The name of the program. Defaults to path.Base(os.Args[0])
|
||||||
Name string
|
Name string
|
||||||
// Full name of command for help, defaults to Name
|
// Full name of command for help, defaults to Name
|
||||||
HelpName string
|
HelpName string
|
||||||
@ -70,8 +71,8 @@ func compileTime() time.Time {
|
|||||||
// Creates a new cli Application with some reasonable defaults for Name, Usage, Version and Action.
|
// Creates a new cli Application with some reasonable defaults for Name, Usage, Version and Action.
|
||||||
func NewApp() *App {
|
func NewApp() *App {
|
||||||
return &App{
|
return &App{
|
||||||
Name: os.Args[0],
|
Name: path.Base(os.Args[0]),
|
||||||
HelpName: os.Args[0],
|
HelpName: path.Base(os.Args[0]),
|
||||||
Usage: "A new cli application",
|
Usage: "A new cli application",
|
||||||
Version: "0.0.0",
|
Version: "0.0.0",
|
||||||
BashComplete: DefaultAppComplete,
|
BashComplete: DefaultAppComplete,
|
||||||
|
Loading…
Reference in New Issue
Block a user