azure-devops-cli-extension
azure-devops-cli-extension copied to clipboard
[Feature Request]Add tag to a work item
The existing work-item update
command sets all tags on a work item. We'd like a way to add a new tag without wiping the existing ones.
System.Tags is physically a scalar field, but logically it's a collection. The relevant operations are - add a tag, remove a tag, maybe replace a tag with another. DevOps CLI doesn't recognize that.
Work-item create and update allow to set the tags but the behaviour of update command is to set the tags field to whatever tags are provider deleting the older ones. If we change the behavior of update to append instead of replace we will not be able to remove the tags which is even bigger loss in functionality since today atleast a get before update can help in achieving both the replace and append functionality.
The ideal solution will be to have command structure like below -
Command | Description | Params | Response | Comments |
---|---|---|---|---|
az boards work-item tag create | Add a new tag to the work item | |||
az boards work-item tag update | Append a new tag to the work item | |||
az boards work-item tag list | Get the list of tags in a work item | |||
az boards work-item tag delete | Remove a tag from a work item |
This functionality has changed since the original report.
The work-item update
command now correctly adds the tag, not removing any existing tags on the workitem. This would still be made easier with this work-item tag
command. Functionality for removing a tag is currently missing and added with this feature.
See also the following discussion: https://stackoverflow.com/questions/68861112/ado-cli-cant-remove-tags https://developercommunity.visualstudio.com/t/ADO-CLI-no-longer-replaces-or-removes-ta/1518061?entry=myfeedback&space=21&preview2=true
Proposed Command Details:
Command | Parameters | Implementation | Response |
---|---|---|---|
az boards work-item tag add | id, tag, org | Implement using existing work_item.update_work_item(id, fields=['System.Tags={tag}']). | Direct response from work item API will be returned |
az boards work-item tag list | id, org | Implement using existing work_item.show_work_item(id, fields=['System.Tags']). | Direct response from API will be returned |
az boards work-item tag remove | id, tag, org | Implement using existing work_item.show_work_item(), subtract the tag, send patch operation of type "replace" to client.update_work_item() DevOps SDK. | Direct response from API will be returned |
Examples: az boards work-item tag add --id 176 --tag mynewtag az boards work-item tag list --id 176 az boards work-item tag remove --id 176 --tag mynewtag
Please advise on the naming. I would suggest "add/remove" for tags on a work-item. A new tag would indeed be created if it did not exist, but tags are never deleted from the project when removed from the workitem. I can see a use for work-item tag update
if it replaces a tag, unless required I think that add+remove covers that.
Is there a need to support multiple tags with the command?
I can pick this up as first issue if that's okay.
I have created a PR for my implementation of this feature. Feel free to add feedback on this or even to suggest a different approach.