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 (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"slices"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
|
@ -39,6 +40,8 @@ var secretFields = []string{
|
|||
"numSelectedRepos",
|
||||
}
|
||||
|
||||
const secretFieldNumSelectedRepos = "numSelectedRepos"
|
||||
|
||||
func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Command {
|
||||
opts := &ListOptions{
|
||||
IO: f.IOStreams,
|
||||
|
|
@ -114,9 +117,12 @@ func listRun(opts *ListOptions) error {
|
|||
return fmt.Errorf("%s secrets are not supported for %s", secretEntity, secretApp)
|
||||
}
|
||||
|
||||
var secrets []Secret
|
||||
showSelectedRepoInfo := opts.IO.IsStdoutTTY()
|
||||
if !showSelectedRepoInfo && opts.Exporter != nil {
|
||||
showSelectedRepoInfo = slices.Contains(opts.Exporter.Fields(), secretFieldNumSelectedRepos)
|
||||
}
|
||||
|
||||
var secrets []Secret
|
||||
switch secretEntity {
|
||||
case shared.Repository:
|
||||
secrets, err = getRepoSecrets(client, baseRepo, secretApp)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue