tools

package
v0.0.0-...-f26991d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2015 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const TEMPLATE_GAE_APP_YAML = `` /* 137-byte string literal not displayed */
View Source
const TEMPLATE_GAE_MAIN_GO = `` /* 311-byte string literal not displayed */
View Source
const TEMPLATE_MAIN_GO = `` /* 787-byte string literal not displayed */

Variables

View Source
var CmdGenerate = cli.Command{
	Name:        "generate",
	ShortName:   "gen",
	Description: "Generate a application directory to start a new project",
	Usage:       `direcrtoy`,
	Flags: []cli.Flag{
		cli.StringFlag{"environment, e", "local", "environment name ('local' or 'gae' is available)", "WCG_ENV"},

		cli.BoolFlag{"no-accesslog", "including access log support", "NO_ACCESS_LOG"},
		cli.BoolFlag{"no-static", "including static file support", "NO_STATIC"},
		cli.BoolFlag{"skip-directory-check", "Skip directory check", "SKIP_DIRECTORY_CHECK"},
	},
	Action: func(c *cli.Context) {
		if len(c.Args()) != 1 {
			fmt.Fprintf(os.Stderr, "A directory path is required in arguments\n")
			cli.ShowCommandHelp(c, "generate")
		} else {
			err := generateAppDir(c.Args()[0], c)
			if err != nil {
				fmt.Fprintf(os.Stderr, "%v\n", err)
				os.Exit(1)
			}
			fmt.Printf("Your WCG project is successfully created!\n")
			os.Exit(0)
		}
	},
}
View Source
var CmdSign = cli.Command{
	Name:      "sign",
	ShortName: "s",
	Usage:     "Sign a value",
	Flags: []cli.Flag{
		cli.StringFlag{"key, k", "wcgsess", "secret key", "KEY"},
	},
	Action: func(c *cli.Context) {
		if len(c.Args()) != 1 {
			cli.ShowCommandHelp(c, "sign")
		} else {
			val := c.Args().First()
			key := c.String("key")
			fmt.Printf("%s\n", wcg.Sign(val, key))
		}
	},
}
View Source
var CmdUnsign = cli.Command{
	Name:      "unsign",
	ShortName: "u",
	Usage:     "Unsign a value",
	Flags: []cli.Flag{
		cli.StringFlag{"key, k", "wcgsess", "secret key", "KEY"},
	},
	Action: func(c *cli.Context) {
		if len(c.Args()) != 1 {
			cli.ShowCommandHelp(c, "unsign")
		} else {
			val := c.Args().First()
			key := c.String("key")
			val2, err := wcg.Unsign(val, key)
			if err != nil {
				fmt.Fprintf(os.Stderr, "Could not unsign the value: %q\n", err)
				os.Exit(1)
			} else {
				fmt.Printf("%s\n", val2)
			}
		}
	},
}

Functions

func ExecCommand

func ExecCommand(args string) (int, string, string)

Execute a tool command with specified arguments

func ExecCommandEx

func ExecCommandEx(args string) string

Execute a tool command and return stdout. It would panic if the command fails, .

func ExecTool

func ExecTool(args string) (int, string, string)

Short hand to execute tool command with panic.

func ExecToolEx

func ExecToolEx(args string) string

Short hand to execute tool command with panic.

func StartCommand

func StartCommand(args string) *exec.Cmd

func StatusOf

func StatusOf(cmd *exec.Cmd) int

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL