Esempio n. 1
0
func download(c *cli.Context) {
	initFlags(c, "download")
	if len(c.Args()) != 1 {
		utils.Exit("Wrong number of arguments. Try 'art download --help'.")
	}
	pattern := c.Args()[0]
	commands.Download(pattern, flags)
}
Esempio n. 2
0
func config(c *cli.Context) {
	if len(c.Args()) > 1 {
		utils.Exit("Wrong number of arguments. Try 'art config --help'.")
	} else if len(c.Args()) == 1 {
		if c.Args()[0] == "show" {
			commands.ShowConfig()
		} else if c.Args()[0] == "clear" {
			commands.ClearConfig()
		} else {
			utils.Exit("Unknown argument '" + c.Args()[0] + "'. Available arguments are 'show' and 'clear'.")
		}
	} else {
		initFlags(c, "config")
		commands.Config(flags.ArtDetails, flags.Interactive, flags.EncPassword)
	}
}
Esempio n. 3
0
func upload(c *cli.Context) {
	initFlags(c, "upload")
	size := len(c.Args())
	if size != 2 {
		utils.Exit("Wrong number of arguments. Try 'art upload --help'.")
	}
	localPath := c.Args()[0]
	targetPath := c.Args()[1]
	commands.Upload(localPath, targetPath, flags)
}
Esempio n. 4
0
func upload(c *cli.Context) {
	initFlags(c, "upload")
	size := len(c.Args())
	if size != 2 {
		utils.Exit(utils.ExitCodeError, "Wrong number of arguments. Try 'art upload --help'.")
	}
	localPath := c.Args()[0]
	targetPath := c.Args()[1]
	uploaded, failed := commands.Upload(localPath, targetPath, flags)
	if failed > 0 {
		if uploaded > 0 {
			utils.Exit(utils.ExitCodeWarning, "")
		}
		utils.Exit(utils.ExitCodeError, "")
	}
}