mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
init cli changes, removed app create from initial walkthrough
This commit is contained in:
@@ -88,9 +88,6 @@ func main() {
|
|||||||
Now run the following CLI commands:
|
Now run the following CLI commands:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Create your first application
|
|
||||||
fn apps create myapp
|
|
||||||
|
|
||||||
# Initialize your function
|
# Initialize your function
|
||||||
# This detects your runtime from the code above and creates a func.yaml
|
# This detects your runtime from the code above and creates a func.yaml
|
||||||
fn init <DOCKERHUB_USERNAME>/hello
|
fn init <DOCKERHUB_USERNAME>/hello
|
||||||
|
|||||||
12
fn/init.go
12
fn/init.go
@@ -99,7 +99,7 @@ func (a *initFnCmd) init(c *cli.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if ff != nil {
|
if ff != nil {
|
||||||
return errors.New("function file already exists")
|
return errors.New("Function file already exists")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ func (a *initFnCmd) init(c *cli.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("func.yaml created.")
|
fmt.Println("func.yaml created")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,11 +142,11 @@ func (a *initFnCmd) buildFuncFile(c *cli.Context) error {
|
|||||||
|
|
||||||
a.name = c.Args().First()
|
a.name = c.Args().First()
|
||||||
if a.name == "" || strings.Contains(a.name, ":") {
|
if a.name == "" || strings.Contains(a.name, ":") {
|
||||||
return errors.New("Please specify a name for your function in the following format <DOCKERHUB_USERNAME>/<FUNCTION_NAME>.\nTry: fn init <DOCKERHUB_USERNAME>/<FUNCTION_NAME>")
|
return errors.New("please specify a name for your function in the following format <DOCKERHUB_USERNAME>/<FUNCTION_NAME>.\nTry: fn init <DOCKERHUB_USERNAME>/<FUNCTION_NAME>")
|
||||||
}
|
}
|
||||||
|
|
||||||
if exists("Dockerfile") {
|
if exists("Dockerfile") {
|
||||||
fmt.Println("Dockerfile found, will use that to build.")
|
fmt.Println("Dockerfile found. Let's use that to build...")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ func (a *initFnCmd) buildFuncFile(c *cli.Context) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if a.entrypoint == "" && a.cmd == "" {
|
if a.entrypoint == "" && a.cmd == "" {
|
||||||
return fmt.Errorf("Could not detect entrypoint or cmd for %v, use --entrypoint and/or --cmd to set them explicitly", a.runtime)
|
return fmt.Errorf("could not detect entrypoint or cmd for %v, use --entrypoint and/or --cmd to set them explicitly", a.runtime)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@@ -194,5 +194,5 @@ func detectRuntime(path string) (runtime string, err error) {
|
|||||||
return runtime, nil
|
return runtime, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "", fmt.Errorf("No supported files found to guess runtime, please set runtime explicitly with --runtime flag")
|
return "", fmt.Errorf("no supported files found to guess runtime, please set runtime explicitly with --runtime flag.")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user