Rename to GitHub (#3)

* circle

* Rename to github and fn->cli

*  Rename to github and fn->cli
This commit is contained in:
Travis Reeder
2017-07-26 10:50:19 -07:00
committed by GitHub
parent 27b665422d
commit 48e3781d5e
9861 changed files with 213 additions and 188 deletions

61
cli/build.go Normal file
View File

@@ -0,0 +1,61 @@
package main
import (
"fmt"
"os"
"github.com/urfave/cli"
)
func build() cli.Command {
cmd := buildcmd{}
flags := append([]cli.Flag{}, cmd.flags()...)
return cli.Command{
Name: "build",
Usage: "build function version",
Flags: flags,
Action: cmd.build,
}
}
type buildcmd struct {
verbose bool
noCache bool
}
func (b *buildcmd) flags() []cli.Flag {
return []cli.Flag{
cli.BoolFlag{
Name: "v",
Usage: "verbose mode",
Destination: &b.verbose,
},
cli.BoolFlag{
Name: "no-cache",
Usage: "Don't use docker cache",
Destination: &b.noCache,
},
}
}
// build will take the found valid function and build it
func (b *buildcmd) build(c *cli.Context) error {
verbwriter := verbwriter(b.verbose)
path, err := os.Getwd()
if err != nil {
return err
}
fn, err := findFuncfile(path)
if err != nil {
return err
}
ff, err := buildfunc(verbwriter, fn, b.noCache)
if err != nil {
return err
}
fmt.Printf("Function %v built successfully.\n", ff.FullName())
return nil
}