本文整理汇总了Golang中github.com/jfrogdev/jfrog-cli-go/utils/cliutils.GetDocumentationMessage函数的典型用法代码示例。如果您正苦于以下问题:Golang GetDocumentationMessage函数的具体用法?Golang GetDocumentationMessage怎么用?Golang GetDocumentationMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetDocumentationMessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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, "")
}
}
示例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())
}
}
示例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
}
示例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, "")
}
}
示例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)
}
示例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)))
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}