Comments (1)
func (app *App) prepareRun() (code int, name string) {
// find command name.
name = app.findCommandName()
if name == HelpCommand {
if len(app.args) == 0 { // like 'help'
app.showApplicationHelp()
} else {
// like 'help COMMAND'
code = app.showCommandHelp(app.args)
}
return
}
// not input and not set defaultCommand
if name == "" {
if app.Func != nil {
code = app.doRunFunc(app.args)
} else {
app.showApplicationHelp()
}
return
}
// name is not empty, but is not command.
if app.inputName == "" {
Logf(VerbDebug, "input the command is not an registered: %s", name)
hookData := map[string]any{"name": name, "args": app.args}
// fire events
if stop := app.Fire(events.OnAppCmdNotFound, hookData); stop {
return
}
if stop := app.Fire(events.OnCmdNotFound, hookData); stop {
return
}
app.showCommandTips(name)
return
}
// is valid command name.
app.commandName = name
return GOON, name
}
I debug to this code , app.inputName
is empty ,Caused the default command to fail
from gcli.
Related Issues (14)
- clone
- TODO: support middleware on execute command
- TODO: support sub-commands HOT 1
- module path error HOT 1
- 如何实现参数的继承 HOT 1
- How to disable the global options? HOT 7
- 缺少import模块 HOT 2
- -h 无法自动输出帮助信息 HOT 4
- 关于交互式建议 HOT 5
- Command Cli时好像无法正确解析`bool`类型
- TODO: 通过结构体绑定选项参数
- gflag.AlignLeft 赋值给 gflag.Config.Alignment 出现类型转换错误 HOT 1
- 命令格式定义建议 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gcli.