repo mirror list: add --repo filter and --sort · Entire
repo mirror list: add --repo filter and --sort
0881217→main·
gtrrz-victor·1w ago·4 files·+317 added/-15 removed
The list is unsorted and, as mirror counts grow, hard to scan. The control plane already filters by owner/provider/cluster but not by repo name, so add a client-side --repo substring filter for that last dimension, plus a generic --sort (by column; '-' prefix descending). Default order is now deterministic: owner/repo ascending, breaking duplicate-repo ties by cluster host.
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Sessions
01KWY5ZZZ8C9C69V5J7W7WGCMRView transcript
Changes
4
cmd/entire/cli
Mcorecmd.go+58
Mcorecmd_test.go+87
Mrepo_mirror.go+64/-8
- Mrepo_mirror_test.go+108/-7
5 unmodified lines
sortRows Function
// sortRows orders items in place by one column's rendered value, ascending case-insensitive string order. spec is a header name; a leading '-' sorts descending.
...
headerIndex Function
// headerIndex returns the index of the column named name (case-insensitive), or -1 if no header matches.
...
cellAt Function
// cellAt returns cells[i], or "" when i is out of range — so a row with fewer cells than headers sorts/filters as empty rather than panicking.
...
printJSON Function
// printJSON writes v as indented JSON to w — the --json view for list/get and mutations.
...
mirrorColumns
var mirrorColumns = []string{"REPO", "CLONE URL", "PRIVATE"}
sortMirrorsDefault Function
// sortMirrorsDefault orders mirrors by the owner/repo name ascending (matching the REPO column and an explicit `--sort repo`), breaking ties by cluster host ascending.
...
filterByRepo Function
// filterByRepo keeps items whose repo name contains substr (case-insensitive).
...
TestRepoMirrorList_FilterSort Function
func TestRepoMirrorList_FilterSort(t *testing.T) {
...
}