Skip to content

Commit

Permalink
improve help messages for tags command
Browse files Browse the repository at this point in the history
  • Loading branch information
rocktavious committed Oct 8, 2023
1 parent f3fbfab commit 24e7c48
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
18 changes: 10 additions & 8 deletions src/cmd/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ import (
var resourceType string

var createTagCmd = &cobra.Command{
Use: "tag --type=RESOURCE_TYPE [--assign] RESOURCE_ID KEY VALUE",
Use: "tag --type=RESOURCE_TYPE [--assign] ID|ALIAS KEY VALUE",
Short: "Create/assign a tag",
Long: "Create/assign a tag",
Example: `
opslevel create tag --type=Team ID|ALIAS KEY VALUE
opslevel create tag --type=Service my-service-alias foo bar
opslevel create tag --type=Team my-team-alias foo bar
opslevel create tag --type=Infra my-infra-alias foo bar
`,
Args: cobra.ExactArgs(3),
ArgAliases: []string{"RESOURCE_ID", "KEY", "VALUE"},
Expand Down Expand Up @@ -69,11 +71,11 @@ opslevel create tag --type=Team ID|ALIAS KEY VALUE
}

var getObjectTagCmd = &cobra.Command{
Use: "tag --type=RESOURCE_TYPE RESOURCE_ID KEY",
Use: "tag --type=RESOURCE_TYPE ID|ALIAS KEY",
Short: "Get tags on an object matching key",
Long: "Get tags on an object matching key",
Example: `
opslevel get tag --type=Service ID|ALIAS KEY | jq
opslevel get tag --type=Service my-service-alias foo
`,
Args: cobra.ExactArgs(2),
ArgAliases: []string{"RESOURCE_ID", "KEY"},
Expand Down Expand Up @@ -103,12 +105,12 @@ opslevel get tag --type=Service ID|ALIAS KEY | jq
}

var listObjectTagCmd = &cobra.Command{
Use: "tag --type=RESOURCE_TYPE RESOURCE_ID",
Use: "tag --type=RESOURCE_TYPE ID|ALIAS",
Aliases: []string{"tags"},
Short: "Get all tags on an object",
Long: "Get all tags on an object",
Example: `
opslevel list tag --type=Service ID|ALIAS
opslevel list tag --type=Service my-service-alias -o json | jq
`,
Args: cobra.ExactArgs(1),
ArgAliases: []string{"RESOURCE_ID"},
Expand All @@ -134,7 +136,7 @@ var updateTagCmd = &cobra.Command{
Short: "Update a tag",
Long: "Update a tag",
Example: `
opslevel update tag TAG_ID KEY VALUE
opslevel update tag XXX_TAG_ID_XXX foo baz
`,
Args: cobra.ExactArgs(3),
ArgAliases: []string{"TAG_ID", "KEY", "VALUE"},
Expand All @@ -160,7 +162,7 @@ var deleteTagCmd = &cobra.Command{
Short: "Delete a tag",
Long: "Delete a tag",
Example: `
opslevel delete tag TAG_ID
opslevel delete tag XXX_TAG_ID_XXX
`,
Args: cobra.ExactArgs(1),
ArgAliases: []string{"TAG_ID"},
Expand Down
4 changes: 2 additions & 2 deletions src/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ go 1.21
require (
github.com/creasty/defaults v1.7.0
github.com/go-git/go-git/v5 v5.9.0
github.com/go-resty/resty/v2 v2.8.0
github.com/go-resty/resty/v2 v2.9.1
github.com/gosimple/slug v1.13.1
github.com/itchyny/gojq v0.12.13
github.com/manifoldco/promptui v0.9.0
github.com/open-policy-agent/opa v0.57.0
github.com/opslevel/opslevel-go/v2023 v2023.9.12
github.com/opslevel/opslevel-go/v2023 v2023.10.8
github.com/relvacode/iso8601 v1.3.0
github.com/rocktavious/autopilot v0.1.5
github.com/rs/zerolog v1.31.0
Expand Down
11 changes: 7 additions & 4 deletions src/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD87
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY=
github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
github.com/go-resty/resty/v2 v2.8.0 h1:J29d0JFWwSWrDCysnOK/YjsPMLQTx0TvgJEHVGvf2L8=
github.com/go-resty/resty/v2 v2.8.0/go.mod h1:UCui0cMHekLrSntoMyofdSTaPpinlRHFtPpizuyDW2w=
github.com/go-resty/resty/v2 v2.9.1 h1:PIgGx4VrHvag0juCJ4dDv3MiFRlDmP0vicBucwf+gLM=
github.com/go-resty/resty/v2 v2.9.1/go.mod h1:4/GYJVjh9nhkhGR6AUNW3XhpDYNUr+Uvy9gV/VGZIy4=
github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y=
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0=
Expand Down Expand Up @@ -336,8 +336,8 @@ github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M=
github.com/open-policy-agent/opa v0.57.0 h1:DftxYfOEHOheXvO2Q6HCIM2ZVdKrvnF4cZlU9C64MIQ=
github.com/open-policy-agent/opa v0.57.0/go.mod h1:3FY6GNSbUqOhjCdvTXCBJ2rNuh66p/XrIc2owr/hSwo=
github.com/opslevel/opslevel-go/v2023 v2023.9.12 h1:qICQMOMO2OZ/cYZ6GiFqIDfQt4tp6lkH/fZQDmDkgCQ=
github.com/opslevel/opslevel-go/v2023 v2023.9.12/go.mod h1:6URZm8V+Zhw7gQ2ox3v9Z43M2FBeoPiuwH4CK4vlpHU=
github.com/opslevel/opslevel-go/v2023 v2023.10.8 h1:qHJjFRrzUoKQ2p0kdfQ4LES39AJ/TTaWWxmTzjyinPQ=
github.com/opslevel/opslevel-go/v2023 v2023.10.8/go.mod h1:wqMN9e6Fw8jIpRf78hOFLqVWOD+gNcbaWAcsdpJvO+o=
github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ=
github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4=
github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4=
Expand Down Expand Up @@ -641,6 +641,9 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
Expand Down

0 comments on commit 24e7c48

Please sign in to comment.