本文整理汇总了Golang中github.com/jfrogdev/jfrog-cli-go/utils/cliutils.GetDocumentationMessage函数的典型用法代码示例。如果您正苦于以下问题:Golang GetDocumentationMessage函数的具体用法?Golang GetDocumentationMessage怎么用?Golang GetDocumentationMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetDocumentationMessage函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: upload
func upload(c *cli.Context) {
if c.NArg() < 2 || c.NArg() > 3 {
cliutils.Exit(cliutils.ExitCodeError, "Wrong number of arguments. "+cliutils.GetDocumentationMessage())
}
localPath := c.Args().Get(0)
versionDetails, err := utils.CreateVersionDetails(c.Args().Get(1))
if err != nil {
cliutils.Exit(cliutils.ExitCodeError, err.Error())
}
uploadPath := c.Args().Get(2)
if strings.HasPrefix(uploadPath, "/") {
uploadPath = uploadPath[1:]
}
uploadFlags, err := createUploadFlags(c)
if err != nil {
cliutils.Exit(cliutils.ExitCodeError, err.Error())
}
uploaded, failed, err := commands.Upload(versionDetails, localPath, uploadPath, uploadFlags)
cliutils.ExitOnErr(err)
if failed > 0 {
if uploaded > 0 {
cliutils.Exit(cliutils.ExitCodeWarning, "")
}
cliutils.Exit(cliutils.ExitCodeError, "")
}
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:27,代码来源:cli.go
示例2: logs
func logs(c *cli.Context) {
bintrayDetails, err := createBintrayDetails(c, true)
if err != nil {
cliutils.Exit(cliutils.ExitCodeError, err.Error())
}
if c.NArg() == 1 {
packageDetails, err := utils.CreatePackageDetails(c.Args().Get(0))
cliutils.ExitOnErr(err)
err = commands.LogsList(packageDetails, bintrayDetails)
cliutils.ExitOnErr(err)
} else if c.NArg() == 3 {
if c.Args().Get(0) == "download" {
packageDetails, err := utils.CreatePackageDetails(c.Args().Get(1))
if err != nil {
cliutils.Exit(cliutils.ExitCodeError, err.Error())
}
err = commands.DownloadLog(packageDetails, c.Args().Get(2), bintrayDetails)
cliutils.ExitOnErr(err)
} else {
cliutils.Exit(cliutils.ExitCodeError, "Unkown argument "+c.Args().Get(0)+". "+cliutils.GetDocumentationMessage())
}
} else {
cliutils.Exit(cliutils.ExitCodeError, "Wrong number of arguments. "+cliutils.GetDocumentationMessage())
}
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:25,代码来源:cli.go
示例3: AddInstance
func AddInstance(instanceName string, flags *AddInstanceFlags) error {
data := AddInstanceRequestContent{
Name: instanceName,
Url: flags.ArtifactoryInstanceDetails.Url,
User: flags.ArtifactoryInstanceDetails.User,
Password: flags.ArtifactoryInstanceDetails.Password,
Description: flags.Description,
Location: flags.Location}
requestContent, err := json.Marshal(data)
if err != nil {
return cliutils.CheckError(errors.New("Failed to execute request. " + cliutils.GetDocumentationMessage()))
}
missionControlUrl := flags.MissionControlDetails.Url + "api/v1/instances"
httpClientDetails := utils.GetMissionControlHttpClientDetails(flags.MissionControlDetails)
resp, body, err := ioutils.SendPost(missionControlUrl, requestContent, httpClientDetails)
if err != nil {
return err
}
if resp.StatusCode == 201 || resp.StatusCode == 204 {
fmt.Println("Mission Control response: " + resp.Status)
} else {
return cliutils.CheckError(errors.New(resp.Status + ". " + utils.ReadMissionControlHttpMessage(body)))
}
return nil
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:25,代码来源:add.go
示例4: uploadCmd
func uploadCmd(c *cli.Context) {
if c.NArg() > 0 && c.IsSet("spec") {
cliutils.Exit(cliutils.ExitCodeError, "No arguments should be sent when the spec option is used. "+cliutils.GetDocumentationMessage())
}
if !(c.NArg() == 2 || (c.NArg() == 0 && c.IsSet("spec"))) {
cliutils.Exit(cliutils.ExitCodeError, "Wrong number of arguments. "+cliutils.GetDocumentationMessage())
}
var uploadSpec *utils.SpecFiles
if c.IsSet("spec") {
var err error
uploadSpec, err = getUploadSpec(c)
cliutils.ExitOnErr(err)
} else {
uploadSpec = createDefaultUploadSpec(c)
}
flags, err := createUploadFlags(c)
cliutils.ExitOnErr(err)
uploaded, failed, err := commands.Upload(uploadSpec, flags)
cliutils.ExitOnErr(err)
if failed > 0 {
if uploaded > 0 {
cliutils.Exit(cliutils.ExitCodeWarning, "")
}
cliutils.Exit(cliutils.ExitCodeError, "")
}
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:28,代码来源:cli.go
示例5: deleteVersion
func deleteVersion(c *cli.Context) {
if c.NArg() != 1 {
cliutils.Exit(cliutils.ExitCodeError, "Wrong number of arguments. "+cliutils.GetDocumentationMessage())
}
versionDetails, err := utils.CreateVersionDetails(c.Args().Get(0))
if err != nil {
cliutils.Exit(cliutils.ExitCodeError, err.Error())
}
bintrayDetails, err := createBintrayDetails(c, true)
if err != nil {
cliutils.Exit(cliutils.ExitCodeError, err.Error())
}
if !c.Bool("quiet") {
var confirm string
fmt.Print("Delete version " + versionDetails.Version +
" of package " + versionDetails.Package + "? (y/n): ")
fmt.Scanln(&confirm)
if !cliutils.ConfirmAnswer(confirm) {
return
}
}
err = commands.DeleteVersion(versionDetails, bintrayDetails)
cliutils.ExitOnErr(err)
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:25,代码来源:cli.go
示例6: searchCmd
func searchCmd(c *cli.Context) {
if c.NArg() > 0 && c.IsSet("spec") {
cliutils.Exit(cliutils.ExitCodeError, "No arguments should be sent when the spec option is used. "+cliutils.GetDocumentationMessage())
}
if !(c.NArg() == 1 || (c.NArg() == 0 && c.IsSet("spec"))) {
cliutils.Exit(cliutils.ExitCodeError, "Wrong number of arguments. "+cliutils.GetDocumentationMessage())
}
var searchSpec *utils.SpecFiles
if c.IsSet("spec") {
var err error
searchSpec, err = getSearchSpec(c)
cliutils.ExitOnErr(err)
} else {
searchSpec = createDefaultSearchSpec(c)
}
flags, err := createSearchFlags(c)
cliutils.ExitOnErr(err)
SearchResult, err := commands.Search(searchSpec, flags)
cliutils.ExitOnErr(err)
result, err := json.Marshal(SearchResult)
cliutils.ExitOnErr(err)
fmt.Println(string(cliutils.IndentJson(result)))
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:26,代码来源:cli.go
示例7: handleEntitlements
func handleEntitlements(c *cli.Context) {
if c.NArg() == 0 {
cliutils.Exit(cliutils.ExitCodeError, "Wrong number of arguments. "+cliutils.GetDocumentationMessage())
}
if c.NArg() == 1 {
bintrayDetails, err := createBintrayDetails(c, true)
cliutils.ExitOnErr(err)
details, err := entitlements.CreateVersionDetails(c.Args().Get(0))
cliutils.ExitOnErr(err)
err = entitlements.ShowEntitlements(bintrayDetails, details)
cliutils.ExitOnErr(err)
return
}
if c.NArg() != 2 {
cliutils.Exit(cliutils.ExitCodeError, "Wrong number of arguments. "+cliutils.GetDocumentationMessage())
}
details, err := entitlements.CreateVersionDetails(c.Args().Get(1))
cliutils.ExitOnErr(err)
var flags *entitlements.EntitlementFlags
switch c.Args().Get(0) {
case "show":
flags, err = createEntitlementFlagsForShowAndDelete(c)
cliutils.ExitOnErr(err)
err = entitlements.ShowEntitlement(flags, details)
case "create":
flags, err = createEntitlementFlagsForCreate(c)
cliutils.ExitOnErr(err)
err = entitlements.CreateEntitlement(flags, details)
case "update":
flags, err = createEntitlementFlagsForUpdate(c)
cliutils.ExitOnErr(err)
err = entitlements.UpdateEntitlement(flags, details)
case "delete":
flags, err = createEntitlementFlagsForShowAndDelete(c)
cliutils.ExitOnErr(err)
err = entitlements.DeleteEntitlement(flags, details)
default:
cliutils.Exit(cliutils.ExitCodeError, "Expecting show, create, update or delete before "+c.Args().Get(1)+". Got "+c.Args().Get(0))
}
cliutils.ExitOnErr(err)
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:42,代码来源:cli.go
示例8: detachLicense
func detachLicense(c *cli.Context) {
size := len(c.Args())
if size != 1 {
cliutils.Exit(cliutils.ExitCodeError, "Wrong number of arguments. "+cliutils.GetDocumentationMessage())
}
flags, err := createDetachLicFlags(c)
if err != nil {
cliutils.Exit(cliutils.ExitCodeError, err.Error())
}
rtinstances.DetachLic(c.Args()[0], flags)
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:11,代码来源:cli.go
示例9: buildDistributeCmd
func buildDistributeCmd(c *cli.Context) {
if c.NArg() != 3 {
cliutils.Exit(cliutils.ExitCodeError, "Wrong number of arguments. "+cliutils.GetDocumentationMessage())
}
buildDistributeFlags, err := createBuildDistributionFlags(c)
if err != nil {
cliutils.ExitOnErr(err)
}
err = commands.BuildDistribute(c.Args().Get(0), c.Args().Get(1), c.Args().Get(2), buildDistributeFlags)
cliutils.ExitOnErr(err)
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:11,代码来源:cli.go
示例10: addInstance
func addInstance(c *cli.Context) {
size := len(c.Args())
if size != 1 {
cliutils.Exit(cliutils.ExitCodeError, "Wrong number of arguments. "+cliutils.GetDocumentationMessage())
}
addInstanceFlags, err := createAddInstanceFlag(c)
if err != nil {
cliutils.Exit(cliutils.ExitCodeError, err.Error())
}
rtinstances.AddInstance(c.Args()[0], addInstanceFlags)
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:11,代码来源:cli.go
示例11: BuildDistribute
func BuildDistribute(buildName, buildNumber, targetRepo string, flags *BuildDistributionFlags) error {
err := utils.PreCommandSetup(flags)
if err != nil {
return err
}
dryRun := ""
if flags.DryRun == true {
dryRun = "[Dry run] "
}
message := "Destributing build..."
log.Info(dryRun + message)
distributeUrl := flags.ArtDetails.Url
restApi := path.Join("api/build/distribute/", buildName, buildNumber)
requestFullUrl, err := utils.BuildArtifactoryUrl(distributeUrl, restApi, make(map[string]string))
if err != nil {
return err
}
data := BuildDistributionConfig{
SourceRepos: strings.Split(flags.SourceRepos, ","),
TargetRepo: targetRepo,
Publish: flags.Publish,
OverrideExistingFiles: flags.OverrideExistingFiles,
GpgPassphrase: flags.GpgPassphrase,
Async: flags.Async,
DryRun: flags.DryRun}
requestContent, err := json.Marshal(data)
if err != nil {
return cliutils.CheckError(errors.New("Failed to execute request. " + cliutils.GetDocumentationMessage()))
}
httpClientsDetails := utils.GetArtifactoryHttpClientDetails(flags.ArtDetails)
utils.SetContentType("application/json", &httpClientsDetails.Headers)
resp, body, err := ioutils.SendPost(requestFullUrl, requestContent, httpClientsDetails)
if err != nil {
return err
}
if resp.StatusCode != 200 {
return cliutils.CheckError(errors.New("Artifactory response: " + resp.Status + "\n" + cliutils.IndentJson(body)))
}
log.Debug("Artifactory response:", resp.Status)
if flags.Async && !flags.DryRun {
log.Info("Asynchronously distributed build", buildName, "#"+buildNumber, "to:", targetRepo, "repository, logs are avalable in Artifactory.")
return nil
}
log.Info(dryRun+"Distributed build", buildName, "#"+buildNumber, "to:", targetRepo, "repository.")
return nil
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:53,代码来源:builddistribute.go
示例12: gpgSignVersion
func gpgSignVersion(c *cli.Context) {
if c.NArg() != 1 {
cliutils.Exit(cliutils.ExitCodeError, "Wrong number of arguments. "+cliutils.GetDocumentationMessage())
}
versionDetails, err := utils.CreateVersionDetails(c.Args().Get(0))
if err != nil {
cliutils.Exit(cliutils.ExitCodeError, err.Error())
}
flags, err := createBintrayDetails(c, true)
if err != nil {
cliutils.Exit(cliutils.ExitCodeError, err.Error())
}
err = commands.GpgSignVersion(versionDetails, c.String("passphrase"), flags)
cliutils.ExitOnErr(err)
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:15,代码来源:cli.go
示例13: createVersion
func createVersion(c *cli.Context) {
if c.NArg() != 1 {
cliutils.Exit(cliutils.ExitCodeError, "Wrong number of arguments "+cliutils.GetDocumentationMessage())
}
versionDetails, err := utils.CreateVersionDetails(c.Args().Get(0))
if err != nil {
cliutils.Exit(cliutils.ExitCodeError, err.Error())
}
versionFlags, err := createVersionFlags(c, "")
if err != nil {
cliutils.Exit(cliutils.ExitCodeError, err.Error())
}
err = commands.CreateVersion(versionDetails, versionFlags)
cliutils.ExitOnErr(err)
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:15,代码来源:cli.go
示例14: signUrl
func signUrl(c *cli.Context) {
if c.NArg() != 1 {
cliutils.Exit(cliutils.ExitCodeError, "Wrong number of arguments. "+cliutils.GetDocumentationMessage())
}
urlSigningDetails, err := utils.CreatePathDetails(c.Args().Get(0))
if err != nil {
cliutils.Exit(cliutils.ExitCodeError, err.Error())
}
urlSigningFlags, err := createUrlSigningFlags(c)
if err != nil {
cliutils.Exit(cliutils.ExitCodeError, err.Error())
}
err = commands.SignVersion(urlSigningDetails, urlSigningFlags)
cliutils.ExitOnErr(err)
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:15,代码来源:cli.go
示例15: publishVersion
func publishVersion(c *cli.Context) {
if c.NArg() != 1 {
cliutils.Exit(cliutils.ExitCodeError, "Wrong number of arguments. "+cliutils.GetDocumentationMessage())
}
versionDetails, err := utils.CreateVersionDetails(c.Args().Get(0))
if err != nil {
cliutils.Exit(cliutils.ExitCodeError, err.Error())
}
bintrayDetails, err := createBintrayDetails(c, true)
if err != nil {
cliutils.Exit(cliutils.ExitCodeError, err.Error())
}
err = commands.PublishVersion(versionDetails, bintrayDetails)
cliutils.ExitOnErr(err)
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:15,代码来源:cli.go
示例16: updatePackage
func updatePackage(c *cli.Context) {
if c.NArg() != 1 {
cliutils.Exit(cliutils.ExitCodeError, "Wrong number of arguments. "+cliutils.GetDocumentationMessage())
}
packageDetails, err := utils.CreatePackageDetails(c.Args().Get(0))
if err != nil {
cliutils.Exit(cliutils.ExitCodeError, err.Error())
}
packageFlags, err := createPackageFlags(c)
if err != nil {
cliutils.Exit(cliutils.ExitCodeError, err.Error())
}
err = commands.UpdatePackage(packageDetails, packageFlags)
cliutils.ExitOnErr(err)
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:15,代码来源:cli.go
示例17: configure
func configure(c *cli.Context) {
if len(c.Args()) > 1 {
cliutils.Exit(cliutils.ExitCodeError, "Wrong number of arguments. "+cliutils.GetDocumentationMessage())
} else if len(c.Args()) == 1 {
if c.Args()[0] == "show" {
commands.ShowConfig()
} else if c.Args()[0] == "clear" {
commands.ClearConfig()
} else {
cliutils.Exit(cliutils.ExitCodeError, "Unknown argument '"+c.Args()[0]+"'. Available arguments are 'show' and 'clear'.")
}
} else {
flags, err := createConfigFlags(c)
cliutils.ExitOnErr(err)
commands.Config(flags.MissionControlDetails, nil, flags.Interactive)
}
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:17,代码来源:cli.go
示例18: AttachLic
func AttachLic(instanceName string, flags *AttachLicFlags) error {
prepareLicenseFile(flags.LicensePath, flags.Override)
postContent := utils.LicenseRequestContent{
Name: instanceName,
NodeID: flags.NodeId,
Deploy: flags.Deploy}
requestContent, err := json.Marshal(postContent)
if err != nil {
return cliutils.CheckError(errors.New("Failed to marshal json. " + cliutils.GetDocumentationMessage()))
}
missionControlUrl := flags.MissionControlDetails.Url + "api/v1/buckets/" + flags.BucketId + "/licenses"
httpClientDetails := utils.GetMissionControlHttpClientDetails(flags.MissionControlDetails)
resp, body, err := ioutils.SendPost(missionControlUrl, requestContent, httpClientDetails)
if err != nil {
return err
}
if resp.StatusCode != 200 {
if flags.LicensePath != "" {
os.Remove(flags.LicensePath)
}
return cliutils.CheckError(errors.New(resp.Status + ". " + utils.ReadMissionControlHttpMessage(body)))
}
fmt.Println("Mission Control response: " + resp.Status)
if flags.LicensePath == "" {
var m Message
m, err = extractJsonValue(body)
if err != nil {
return err
}
requestContent, err = json.Marshal(m)
err = cliutils.CheckError(err)
if err != nil {
return err
}
fmt.Println(string(requestContent))
} else {
var licenseKey []byte
licenseKey, err = getLicenseFromJson(body)
if err != nil {
return err
}
err = saveLicense(flags.LicensePath, licenseKey)
}
return nil
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:45,代码来源:attachlic.go
示例19: stream
func stream(c *cli.Context) {
bintrayDetails, err := createBintrayDetails(c, true)
if err != nil {
cliutils.Exit(cliutils.ExitCodeError, err.Error())
}
if c.NArg() != 1 {
cliutils.Exit(cliutils.ExitCodeError, "Wrong number of arguments. "+cliutils.GetDocumentationMessage())
}
streamDetails := &commands.StreamDetails{
BintrayDetails: bintrayDetails,
Subject: c.Args().Get(0),
Include: c.String("include"),
}
err = commands.Stream(streamDetails, os.Stdout)
if err != nil {
cliutils.Exit(cliutils.ExitCodeError, "")
}
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:19,代码来源:cli.go
示例20: downloadFile
func downloadFile(c *cli.Context) {
if c.NArg() < 1 || c.NArg() > 2 {
cliutils.Exit(cliutils.ExitCodeError, "Wrong number of arguments. "+cliutils.GetDocumentationMessage())
}
pathDetails, err := utils.CreatePathDetails(c.Args().Get(0))
if err != nil {
cliutils.Exit(cliutils.ExitCodeError, err.Error())
}
targetPath := c.Args().Get(1)
if strings.HasPrefix(targetPath, "/") {
targetPath = targetPath[1:]
}
flags, err := createDownloadFlags(c)
if err != nil {
cliutils.Exit(cliutils.ExitCodeError, err.Error())
}
err = commands.DownloadFile(pathDetails, targetPath, flags)
cliutils.ExitOnErr(err)
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:20,代码来源:cli.go
注:本文中的github.com/jfrogdev/jfrog-cli-go/utils/cliutils.GetDocumentationMessage函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论