Remove language default and fix command flags

This commit stops using `node` as a default language due to it
conflicting with functions where the `fprocess` is set in the image.

Given the large numbers of languages having a default makes less sense
now.

It also removes some of the copy-paste/redundant/irrelevant flag
definitions that ended up in newly added subcommands.

Signed-off-by: John McCabe <john@johnmccabe.net>
This commit is contained in:
John McCabe
2017-10-15 20:44:46 +01:00
committed by Alex Ellis
parent b05b52960a
commit 1d336eeb22
5 changed files with 5 additions and 12 deletions

View File

@@ -10,11 +10,12 @@ So if you want to write in another language, just prepare a Dockerfile and build
This will generate a Docker image for a Node.js function using the code in `/samples/info`.
* The `faas-cli build` command can accept a `--lang` option of `python` or `node` and is `node` by default.
* The `faas-cli build` command can accept a `--lang` option of `python`, `node`, `ruby`, `csharp`, `python3`, `go`, or `dockerfile`.
```
$ faas-cli build \
--image=alexellis2/node_info \
--lang= node \
--name=node_info \
--handler=./sample/node_info

View File

@@ -26,7 +26,7 @@ func init() {
buildCmd.Flags().StringVar(&image, "image", "", "Docker image name to build")
buildCmd.Flags().StringVar(&handler, "handler", "", "Directory with handler for function, e.g. handler.js")
buildCmd.Flags().StringVar(&functionName, "name", "", "Name of the deployed function")
buildCmd.Flags().StringVar(&language, "lang", "node", "Programming language template")
buildCmd.Flags().StringVar(&language, "lang", "", "Programming language template")
// Setup flags that are used only by this command (variables defined above)
buildCmd.Flags().BoolVar(&nocache, "no-cache", false, "Do not use Docker's build cache")

View File

@@ -34,7 +34,7 @@ func init() {
deployCmd.Flags().StringVar(&gateway, "gateway", defaultGateway, "Gateway URI")
deployCmd.Flags().StringVar(&handler, "handler", "", "Directory with handler for function, e.g. handler.js")
deployCmd.Flags().StringVar(&image, "image", "", "Docker image name to build")
deployCmd.Flags().StringVar(&language, "lang", "node", "Programming language template")
deployCmd.Flags().StringVar(&language, "lang", "", "Programming language template")
deployCmd.Flags().StringVar(&functionName, "name", "", "Name of the deployed function")
deployCmd.Flags().StringVar(&network, "network", defaultNetwork, "Name of the network")

View File

@@ -15,8 +15,7 @@ import (
)
var (
verboseInvoke bool
contentType string
contentType string
)
func init() {
@@ -24,9 +23,7 @@ func init() {
invokeCmd.Flags().StringVar(&functionName, "name", "", "Name of the deployed function")
invokeCmd.Flags().StringVar(&gateway, "gateway", defaultGateway, "Gateway URI")
invokeCmd.Flags().StringVar(&language, "lang", "node", "Programming language template")
invokeCmd.Flags().StringVar(&contentType, "content-type", "text/plain", "The content-type HTTP header such as application/json")
invokeCmd.Flags().BoolVar(&verboseInvoke, "verbose", false, "Verbose output for the function list")
faasCmd.AddCommand(invokeCmd)
}

View File

@@ -18,12 +18,7 @@ var (
func init() {
// Setup flags that are used by multiple commands (variables defined in faas.go)
listCmd.Flags().StringVar(&fprocess, "fprocess", "", "Fprocess to be run by the watchdog")
listCmd.Flags().StringVar(&gateway, "gateway", defaultGateway, "Gateway URI")
listCmd.Flags().StringVar(&handler, "handler", "", "Directory with handler for function, e.g. handler.js")
listCmd.Flags().StringVar(&image, "image", "", "Docker image name to build")
listCmd.Flags().StringVar(&language, "lang", "node", "Programming language template")
listCmd.Flags().StringVar(&functionName, "name", "", "Name of the deployed function")
listCmd.Flags().BoolVar(&verboseList, "verbose", false, "Verbose output for the function list")