Populate numSelectedRepos in non-interactive mode, if explicitly selected
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
This commit is contained in:
parent
ec812a16f7
commit
148f9527c1
1 changed files with 7 additions and 1 deletions
|
|
@ -3,6 +3,7 @@ package list
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|
@ -39,6 +40,8 @@ var secretFields = []string{
|
||||||
"numSelectedRepos",
|
"numSelectedRepos",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const secretFieldNumSelectedRepos = "numSelectedRepos"
|
||||||
|
|
||||||
func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Command {
|
func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Command {
|
||||||
opts := &ListOptions{
|
opts := &ListOptions{
|
||||||
IO: f.IOStreams,
|
IO: f.IOStreams,
|
||||||
|
|
@ -114,9 +117,12 @@ func listRun(opts *ListOptions) error {
|
||||||
return fmt.Errorf("%s secrets are not supported for %s", secretEntity, secretApp)
|
return fmt.Errorf("%s secrets are not supported for %s", secretEntity, secretApp)
|
||||||
}
|
}
|
||||||
|
|
||||||
var secrets []Secret
|
|
||||||
showSelectedRepoInfo := opts.IO.IsStdoutTTY()
|
showSelectedRepoInfo := opts.IO.IsStdoutTTY()
|
||||||
|
if !showSelectedRepoInfo && opts.Exporter != nil {
|
||||||
|
showSelectedRepoInfo = slices.Contains(opts.Exporter.Fields(), secretFieldNumSelectedRepos)
|
||||||
|
}
|
||||||
|
|
||||||
|
var secrets []Secret
|
||||||
switch secretEntity {
|
switch secretEntity {
|
||||||
case shared.Repository:
|
case shared.Repository:
|
||||||
secrets, err = getRepoSecrets(client, baseRepo, secretApp)
|
secrets, err = getRepoSecrets(client, baseRepo, secretApp)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue