Skip to content

Commit

Permalink
Merge branch 'main' into wcrum-tls-flags-rework
Browse files Browse the repository at this point in the history
Signed-off-by: will <30413278+wcrum@users.noreply.github.com>
  • Loading branch information
wcrum authored Aug 23, 2024
2 parents 2a14fbf + bd0cd8f commit c32ca71
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/hauler/cli/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ type Opts struct {

func (o *Opts) AddArgs(cmd *cobra.Command) {
f := cmd.Flags()
f.StringVarP(&o.Username, "username", "u", "", "Username")
f.StringVarP(&o.Password, "password", "p", "", "Password")
f.BoolVarP(&o.PasswordStdin, "password-stdin", "", false, "Take the password from stdin")
f.StringVarP(&o.Username, "username", "u", "", "Username to use for authentication")
f.StringVarP(&o.Password, "password", "p", "", "Password to use for authentication")
f.BoolVar(&o.PasswordStdin, "password-stdin", false, "Password to use for authentication (from stdin)")
}

func addLogin(parent *cobra.Command) {
Expand Down
29 changes: 29 additions & 0 deletions cmd/hauler/cli/store/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ func InfoCmd(ctx context.Context, o *flags.InfoOpts, s *store.Layout) error {
return err
}

if o.ListRepos {

Check failure on line 107 in cmd/hauler/cli/store/info.go

View workflow job for this annotation

GitHub Actions / Unit Tests

o.ListRepos undefined (type *"github.com/rancherfederal/hauler/internal/flags".InfoOpts has no field or method ListRepos)
buildListRepos(items...)
return nil
}

// sort items by ref and arch
sort.Sort(byReferenceAndArch(items))

Expand All @@ -118,6 +123,30 @@ func InfoCmd(ctx context.Context, o *flags.InfoOpts, s *store.Layout) error {
return nil
}

func buildListRepos(items ...item) {
// Create map to track unique repository names
repos := make(map[string]bool)

for _, i := range items {
repoName := ""
for j := 0; j < len(i.Reference); j++ {
if i.Reference[j] == '/' {
repoName = i.Reference[:j]
break
}
}
if repoName == "" {
repoName = i.Reference
}
repos[repoName] = true
}

// Collect and print unique repository names
for repoName := range repos {
fmt.Println(repoName)
}
}

func buildTable(items ...item) {
// Create a table for the results
table := tablewriter.NewWriter(os.Stdout)
Expand Down

0 comments on commit c32ca71

Please sign in to comment.