提交 2054316e 编写于 作者: weixin_53053927's avatar weixin_53053927

refactor(cli): support shorthand flags

上级 dd9b3f0e
......@@ -28,7 +28,7 @@ func NewCmdBuild() *cobra.Command {
},
}
cmd.Flags().StringVar(&opts.Filename, "file-name", "app.go", "Serverless function file (default is app.go)")
cmd.Flags().StringVarP(&opts.Filename, "file-name", "f", "app.go", "Serverless function file (default is app.go)")
return cmd
}
......@@ -21,7 +21,7 @@ func NewCmdDev() *cobra.Command {
var cmd = &cobra.Command{
Use: "dev",
Short: "Dev a YoMo Serverless Function.",
Short: "Dev a YoMo Serverless Function",
Long: "Dev a YoMo Serverless Function with mocking yomo-source data from YCloud.",
Run: func(cmd *cobra.Command, args []string) {
slHandler, err := buildAndLoadHandler(&opts.baseOptions, args)
......@@ -42,8 +42,8 @@ func NewCmdDev() *cobra.Command {
},
}
cmd.Flags().StringVar(&opts.Filename, "file-name", "app.go", "Serverless function file (default is app.go)")
cmd.Flags().IntVar(&opts.Port, "port", 4242, "Port is the port number of UDP host for Serverless function (default is 4242)")
cmd.Flags().StringVarP(&opts.Filename, "file-name", "f", "app.go", "Serverless function file (default is app.go)")
cmd.Flags().IntVarP(&opts.Port, "port", "p", 4242, "Port is the port number of UDP host for Serverless function (default is 4242)")
return cmd
}
......@@ -50,8 +50,8 @@ func NewCmdRun() *cobra.Command {
},
}
cmd.Flags().StringVar(&opts.Filename, "file-name", "app.go", "Serverless function file (default is app.go)")
cmd.Flags().IntVar(&opts.Port, "port", 4242, "Port is the port number of UDP host for Serverless function (default is 4242)")
cmd.Flags().StringVarP(&opts.Filename, "file-name", "f", "app.go", "Serverless function file (default is app.go)")
cmd.Flags().IntVarP(&opts.Port, "port", "p", 4242, "Port is the port number of UDP host for Serverless function (default is 4242)")
return cmd
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册