本文整理汇总了Golang中github.com/JFrogDev/artifactory-cli-go/Godeps/_workspace/src/github.com/codegangsta/cli.Context.Args方法的典型用法代码示例。如果您正苦于以下问题:Golang Context.Args方法的具体用法?Golang Context.Args怎么用?Golang Context.Args使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/JFrogDev/artifactory-cli-go/Godeps/_workspace/src/github.com/codegangsta/cli.Context
的用法示例。
在下文中一共展示了Context.Args方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: download
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)
}
示例2: config
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)
}
}
示例3: upload
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)
}
示例4: upload
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, "")
}
}