From db07ba5bf24d6aeab6225a83e6bf475d6cacbce1 Mon Sep 17 00:00:00 2001 From: taimoor ahmad <139589712+taimoor-at-opslevel@users.noreply.github.com> Date: Thu, 14 Sep 2023 10:59:08 -0400 Subject: [PATCH] Update src/cmd/tag.go Co-authored-by: David Bloss --- src/cmd/tag.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/cmd/tag.go b/src/cmd/tag.go index 4df7a4e4..b74b4928 100644 --- a/src/cmd/tag.go +++ b/src/cmd/tag.go @@ -32,25 +32,20 @@ opslevel create tag --type=Team ID|ALIAS KEY VALUE value := args[2] if cmd.Flag("assign").Changed { - var input opslevel.TagAssignInput tagInput := opslevel.TagInput{ Key: key, Value: value, } + input := opslevel.TagAssignInput{Tags: []opslevel.TagInput{tagInput}} if opslevel.IsID(resource) { - input = opslevel.TagAssignInput{ - Id: opslevel.ID(resource), - Tags: []opslevel.TagInput{tagInput}, - } + input.Id = opslevel.ID(resource) } else { - input = opslevel.TagAssignInput{ - Alias: resource, - Type: opslevel.TaggableResource(resourceType), - Tags: []opslevel.TagInput{tagInput}, - } + input.Alias = resource + input.Type = opslevel.TaggableResource(resourceType) } + result, err := getClientGQL().AssignTag(input) cobra.CheckErr(err) fmt.Printf("updated new tag on %s: %s\n", resource, result[0].Id)