feature: add variable delete command
Created by: bradym
Description
This PR addresses #889 (closed) by adding a new glab variable delete
command.
I tried to follow established patterns as best I could, but please let me know what improvements you'd like to see.
In addition to adding the delete command, I added a new variableutils
package and moved the isValidKey
function and validKeyMsg
there so they could be shared between the set
and delete
commands.
I have marked this as a draft PR as I have not yet added tests for the new delete command code, I will work on that this week. I wanted to get this PR created to get any feedback you may have so I can address that while working on the tests.
How Has This Been Tested?
So far I have tested by running the commands in the help output:
$ glab variable delete VAR_NAME
$ glab variable delete VAR_NAME --scope=prod
$ glab variable delete VARNAME -g mygroup
I've also run existing tests to ensure my changes have not broken any existing functionality related to variables:
root@dd3ab0757245:/app# bin/gotestsum --packages ./commands/variable
✓ commands/variable (17ms)
DONE 1 tests in 0.971s
root@dd3ab0757245:/app# bin/gotestsum --packages ./commands/variable/set
✓ commands/variable/set (19ms)
DONE 14 tests in 1.026s
root@dd3ab0757245:/app# bin/gotestsum --packages ./commands/variable/variableutils
✓ commands/variable/variableutils (cached)
DONE 4 tests in 0.223s
Types of changes
-
Bug fix (non-breaking change which fixes an issue) -
New feature (non-breaking change which adds functionality) -
Breaking change (fix or feature that would cause existing functionality to change) -
Documentation -
Chore (Related to CI or Packaging to platforms)