cli
cli copied to clipboard
feat: Add support for different output formats on project view and project variables view command
Added support for basic, json and table formats for the following octopus commands:
-
project view -
project variable view
Partially fixes #312 (for project view
Before project view:
octopus project view "A project"
A project (a-project)
Version control branch: Not version controlled
A sample project description
View this project in Octopus Deploy: https://your.octopus.app/app#/Spaces-1/projects/Projects-4021
After project view:
BASIC format
octopus project view "A project" -f basic
Name: A project (a-project)
Description: A sample project description
Is version controlled: false
Branch: N/A
View this project in Octopus Deploy: https://your.octopus.app/app#/Spaces-1/projects/Projects-4021
TABLE format:
octopus project view "A project" -f table
KEY VALUE
Name A project
Slug a-project
Description A sample project description
IsVersionControlled false
Branch N/A
Url https://your.octopus.app/app#/Spaces-1/projects/Projects-4021
JSON format:
octopus project view "A project" -f json
{
"name": "A project",
"slug": "a-project",
"description": "sample project description",
"isversioncontrolled": false,
"branch": "N/A",
"url": "https://your.octopus.app/app#/Spaces-1/projects/Projects-4021"
}
Note: this PR does change the output to be in table view if no format is specified for project view. This seems logical given the default output format is table anyway.
Before project variable view:
octopus project variable view "myvariable" --project "A project"
myvariable
Id 5c931f22-3fc0-f22e-9bac-8b5771a255c4
Value dev
Description No description provided
Environment scope Development
Id b36974f9-0f7a-8ad3-2f6e-65ace11bacb0
Value test
Description No description provided
Environment scope Test, Staging
Id 9b90f5d3-f498-be81-491d-1efa62c1ed2b
Value machine
Description No description provided
Machine scope build01
Id 5bed199f-e1da-6f2f-b43c-40d7751c69c9
Value def-channel
Description No description provided
Channel scope Default
Id 84db4e15-ddf4-d38b-a716-0268cfc951e3
Value prompted
Description mydesc
Prompted true
Prompt Label mylabel
Prompt Description mylabeldesc
Prompt Required false
After project variable view:
BASIC and TABLE format: No change
JSON format:
octopus project variable view "myvariable" --project "A project" -f json
[
{
"id": "5c931f22-3fc0-f22e-9bac-8b5771a255c4",
"value": "dev",
"description": "",
"environmentscope": [
{
"id": "Environments-1",
"name": "Development"
}
],
"rolescope": null,
"machinescope": null,
"processscope": null,
"stepscope": null,
"channelscope": null
},
{
"id": "b36974f9-0f7a-8ad3-2f6e-65ace11bacb0",
"value": "test",
"description": "",
"environmentscope": [
{
"id": "Environments-2",
"name": "Test"
},
{
"id": "Environments-403",
"name": "Staging"
}
],
"rolescope": null,
"machinescope": null,
"processscope": null,
"stepscope": null,
"channelscope": null
},
{
"id": "9b90f5d3-f498-be81-491d-1efa62c1ed2b",
"value": "machine",
"description": "",
"environmentscope": null,
"rolescope": null,
"machinescope": [
{
"id": "Machines-962",
"name": "build01"
}
],
"processscope": null,
"stepscope": null,
"channelscope": null
},
{
"id": "5bed199f-e1da-6f2f-b43c-40d7751c69c9",
"value": "def-channel",
"description": "",
"environmentscope": null,
"rolescope": null,
"machinescope": null,
"processscope": null,
"stepscope": null,
"channelscope": [
{
"id": "Channels-4161",
"name": "Default"
}
]
},
{
"id": "84db4e15-ddf4-d38b-a716-0268cfc951e3",
"value": "prompted",
"description": "mydesc",
"environmentscope": null,
"rolescope": null,
"machinescope": null,
"processscope": null,
"stepscope": null,
"channelscope": null,
"prompted": true,
"promptlabel": "mylabel",
"promptlabeldescription": "mylabeldesc",
"promptrequired": "false"
}
]
Linked with https://github.com/OctopusDeploy/cli/pull/318 which looks to fix project-group view