cmd

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2014 License: BSD-4-Clause, MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EnvFlag    = cli.StringSlice([]string{})
	FilesFlag  = cli.StringSlice([]string{})
	RunCommand = cli.Command{
		Name:      "run",
		ShortName: "r",
		Usage:     "Run any command for your app",
		Flags: []cli.Flag{
			cli.StringSliceFlag{"env, e", &EnvFlag, "Environment variables", ""},
			cli.StringSliceFlag{"file, f", &FilesFlag, "Files to upload", ""},
		},
		Description: `Run command in current app context, your application
   environment will be loaded and you can execute any task.
     Example
       'appsdeck --app my-app run bundle exec rails console'
       'appsdeck --app synfony-app run php app/console cache:clear --env=prod'`,
		Action: func(c *cli.Context) {
			auth.InitAuth()
			currentApp := appdetect.CurrentApp(c.GlobalString("app"))
			if len(c.Args()) == 0 {
				cli.ShowCommandHelp(c, "run")
			} else if err := apps.Run(currentApp, c.Args(), c.StringSlice("e"), c.StringSlice("f")); err != nil {
				errorQuit(err)
			}
		},
	}
)
View Source
var (
	AppsCommand = cli.Command{
		Name:        "apps",
		ShortName:   "a",
		Description: "List your apps and give some details about them",
		Usage:       "List your apps",
		Action: func(c *cli.Context) {
			auth.InitAuth()
			if err := apps.List(); err != nil {
				errorQuit(err)
			}
		},
	}
)
View Source
var (
	CreateCommand = cli.Command{
		Name:        "create",
		ShortName:   "c",
		Description: "Create a new app:\n   Example:\n     'appsdeck create mynewapp'",
		Usage:       "Create a new app",
		Action: func(c *cli.Context) {
			auth.InitAuth()
			if len(c.Args()) != 1 {
				cli.ShowCommandHelp(c, "create")
			} else {
				apps.Create(c.Args()[0])
			}
		},
	}
)
View Source
var (
	DestroyCommand = cli.Command{
		Name:        "destroy",
		ShortName:   "d",
		Usage:       "Destroy an app /!\\",
		Description: "Destroy an app /!\\ It is not reversible\n  Example:\n    'appsdeck destroy my-app'",
		Action: func(c *cli.Context) {
			auth.InitAuth()
			if len(c.Args()) != 1 {
				cli.ShowCommandHelp(c, "destroy")
			} else {
				var validationName string
				appName := c.Args()[0]
				fmt.Printf("/!\\ Your going to delete %s, this operation is irreversible.\nTo confirm type the name of the application: ", appName)
				fmt.Scan(&validationName)
				if validationName == appName {
					apps.Destroy(appName)
				} else {
					fmt.Printf("'%s' is not '%s', aborting…\n", validationName, appName)
				}
			}
		},
	}
)
View Source
var (
	LogoutCommand = cli.Command{
		Name:        "logout",
		Usage:       "Logout from Appsdeck",
		Description: "Destroy login information stored on your computer",
		Action: func(c *cli.Context) {
			if err := session.DestroyToken(); err != nil {
				panic(err)
			}
			fmt.Println("Appsdeck credentials have been deleted.")
		},
	}
)
View Source
var (
	LogsCommand = cli.Command{
		Name:      "logs",
		ShortName: "l",
		Usage:     "Get the logs of your applications",
		Description: `Get the logs of your applications
   Example:
     Get 100 lines:  'appsdeck --app my-app logs -n 100'
     Real-Time logs: 'appsdeck --app my-app logs -f'`,
		Flags: []cli.Flag{
			cli.IntFlag{"lines, n", 20, "Number of log lines to dump", ""},
			cli.BoolFlag{"follow, f", "Stream logs of app, (as \"tail -f\")", ""},
		},
		Action: func(c *cli.Context) {
			auth.InitAuth()
			currentApp := appdetect.CurrentApp(c.GlobalString("app"))
			if len(c.Args()) == 0 || len(c.Args()) == 2 && c.Int("n") != 0 {
				if err := apps.Logs(currentApp, c.Bool("f"), c.Int("n")); err != nil {
					errorQuit(err)
				}
			} else {
				cli.ShowCommandHelp(c, "logs")
			}
		},
	}
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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