Skip to content

Commit e1bbcc2

Browse files
committed
Split azure-devops-cli SKILL.md into samller files
1 parent 4488150 commit e1bbcc2

8 files changed

Lines changed: 2408 additions & 2398 deletions

File tree

skills/azure-devops-cli/SKILL.md

Lines changed: 26 additions & 2398 deletions
Large diffs are not rendered by default.
Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
# Advanced Usage: Output, Queries & Parameters
2+
3+
## Table of Contents
4+
- [Output Formats](#output-formats)
5+
- [JMESPath Queries](#jmespath-queries)
6+
- [Advanced JMESPath Queries](#advanced-jmespath-queries)
7+
- [Global Arguments](#global-arguments)
8+
- [Common Parameters](#common-parameters)
9+
- [Git Aliases](#git-aliases)
10+
- [Getting Help](#getting-help)
11+
12+
---
13+
14+
## Output Formats
15+
16+
All commands support multiple output formats:
17+
18+
```bash
19+
# Table format (human-readable)
20+
az pipelines list --output table
21+
22+
# JSON format (default, machine-readable)
23+
az pipelines list --output json
24+
25+
# JSONC (colored JSON)
26+
az pipelines list --output jsonc
27+
28+
# YAML format
29+
az pipelines list --output yaml
30+
31+
# YAMLC (colored YAML)
32+
az pipelines list --output yamlc
33+
34+
# TSV format (tab-separated values)
35+
az pipelines list --output tsv
36+
37+
# None (no output)
38+
az pipelines list --output none
39+
```
40+
41+
## JMESPath Queries
42+
43+
Filter and transform output:
44+
45+
```bash
46+
# Filter by name
47+
az pipelines list --query "[?name=='myPipeline']"
48+
49+
# Get specific fields
50+
az pipelines list --query "[].{Name:name, ID:id}"
51+
52+
# Chain queries
53+
az pipelines list --query "[?name.contains('CI')].{Name:name, ID:id}" --output table
54+
55+
# Get first result
56+
az pipelines list --query "[0]"
57+
58+
# Get top N
59+
az pipelines list --query "[0:5]"
60+
```
61+
62+
## Advanced JMESPath Queries
63+
64+
### Filtering and Sorting
65+
66+
```bash
67+
# Filter by multiple conditions
68+
az pipelines list --query "[?name.contains('CI') && enabled==true]"
69+
70+
# Filter by status and result
71+
az pipelines runs list --query "[?status=='completed' && result=='succeeded']"
72+
73+
# Sort by date (descending)
74+
az pipelines runs list --query "sort_by([?status=='completed'], &finishTime | reverse(@))"
75+
76+
# Get top N items after filtering
77+
az pipelines runs list --query "[?result=='succeeded'] | [0:5]"
78+
```
79+
80+
### Nested Queries
81+
82+
```bash
83+
# Extract nested properties
84+
az pipelines show --id $PIPELINE_ID --query "{Name:name, Repo:repository.{Name:name, Type:type}, Folder:folder}"
85+
86+
# Query build details
87+
az pipelines build show --id $BUILD_ID --query "{ID:id, Number:buildNumber, Status:status, Result:result, Requested:requestedFor.displayName}"
88+
```
89+
90+
### Complex Filtering
91+
92+
```bash
93+
# Find pipelines with specific YAML path
94+
az pipelines list --query "[?process.type.name=='yaml' && process.yamlFilename=='azure-pipelines.yml']"
95+
96+
# Find PRs from specific reviewer
97+
az repos pr list --query "[?contains(reviewers[?displayName=='John Doe'].displayName, 'John Doe')]"
98+
99+
# Find work items with specific iteration and state
100+
az boards work-item show --id $WI_ID --query "{Title:fields['System.Title'], State:fields['System.State'], Iteration:fields['System.IterationPath']}"
101+
```
102+
103+
### Aggregation
104+
105+
```bash
106+
# Count items by status
107+
az pipelines runs list --query "groupBy([?status=='completed'], &[result]) | {Succeeded: [?key=='succeeded'][0].count, Failed: [?key=='failed'][0].count}"
108+
109+
# Get unique reviewers
110+
az repos pr list --query "unique_by(reviewers[], &displayName)"
111+
112+
# Sum values
113+
az pipelines runs list --query "[?result=='succeeded'] | [].{Duration:duration} | [0].Duration"
114+
```
115+
116+
### Conditional Transformation
117+
118+
```bash
119+
# Format dates
120+
az pipelines runs list --query "[].{ID:id, Date:createdDate, Formatted:createdDate | format_datetime(@, 'yyyy-MM-dd HH:mm')}"
121+
122+
# Conditional output
123+
az pipelines list --query "[].{Name:name, Status:(enabled ? 'Enabled' : 'Disabled')}"
124+
125+
# Extract with defaults
126+
az pipelines show --id $PIPELINE_ID --query "{Name:name, Folder:folder || 'Root', Description:description || 'No description'}"
127+
```
128+
129+
### Complex Workflows
130+
131+
```bash
132+
# Find longest running builds
133+
az pipelines build list --query "sort_by([?result=='succeeded'], &queueTime) | reverse(@) | [0:3].{ID:id, Number:buildNumber, Duration:duration}"
134+
135+
# Get PR statistics per reviewer
136+
az repos pr list --query "groupBy([], &reviewers[].displayName) | [].{Reviewer:@.key, Count:length(@)}"
137+
138+
# Find work items with multiple child items
139+
az boards work-item relation list --id $PARENT_ID --query "[?rel=='System.LinkTypes.Hierarchy-Forward'] | [].{ChildID:url | split('/', @) | [-1]}"
140+
```
141+
142+
## Global Arguments
143+
144+
Available on all commands:
145+
146+
| Parameter | Description |
147+
|---|---|
148+
| `--help` / `-h` | Show command help |
149+
| `--output` / `-o` | Output format (json, jsonc, none, table, tsv, yaml, yamlc) |
150+
| `--query` | JMESPath query string for filtering output |
151+
| `--verbose` | Increase logging verbosity |
152+
| `--debug` | Show all debug logs |
153+
| `--only-show-errors` | Only show errors, suppress warnings |
154+
| `--subscription` | Name or ID of subscription |
155+
| `--yes` / `-y` | Skip confirmation prompts |
156+
157+
## Common Parameters
158+
159+
| Parameter | Description |
160+
|---|---|
161+
| `--org` / `--organization` | Azure DevOps organization URL (e.g., `https://dev.azure.com/{org}`) |
162+
| `--project` / `-p` | Project name or ID |
163+
| `--detect` | Auto-detect organization from git config |
164+
| `--yes` / `-y` | Skip confirmation prompts |
165+
| `--open` | Open resource in web browser |
166+
| `--subscription` | Azure subscription (for Azure resources) |
167+
168+
## Git Aliases
169+
170+
After enabling git aliases:
171+
172+
```bash
173+
# Enable Git aliases
174+
az devops configure --use-git-aliases true
175+
176+
# Use Git commands for DevOps operations
177+
git pr create --target-branch main
178+
git pr list
179+
git pr checkout 123
180+
```
181+
182+
## Getting Help
183+
184+
```bash
185+
# General help
186+
az devops --help
187+
188+
# Help for specific command group
189+
az pipelines --help
190+
az repos pr --help
191+
192+
# Help for specific command
193+
az repos pr create --help
194+
195+
# Search for examples
196+
az find "az repos pr create"
197+
```

0 commit comments

Comments
 (0)