Skip to content

Commit

Permalink
Merge pull request #55 from rancherfederal/cli-ux
Browse files Browse the repository at this point in the history
* cli ux and verbiage cleanup
* add `hauler store add` command
  • Loading branch information
joshrwolf authored Nov 1, 2021
2 parents 880b296 + cde59ce commit 8a46c20
Show file tree
Hide file tree
Showing 13 changed files with 385 additions and 165 deletions.
5 changes: 1 addition & 4 deletions cmd/hauler/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ func New() *cobra.Command {
pf.StringVar(&ro.cacheDir, "cache", "", "Location of where to store cache data (defaults to XDG_CACHE_DIR/hauler)")

// Add subcommands
addGet(cmd)
addSave(cmd)
addLoad(cmd)
addServe(cmd)
addDownload(cmd)
addStore(cmd)

return cmd
Expand Down
26 changes: 26 additions & 0 deletions cmd/hauler/cli/download.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package cli

import (
"github.com/spf13/cobra"

"github.com/rancherfederal/hauler/cmd/hauler/cli/download"
)

func addDownload(parent *cobra.Command) {
o := &download.Opts{}

cmd := &cobra.Command{
Use: "download",
Short: "Download OCI content from a registry and populate it on disk",
Aliases: []string{"dl"},
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, arg []string) error {
ctx := cmd.Context()

return download.Cmd(ctx, o, arg[0])
},
}
o.AddArgs(cmd)

parent.AddCommand(cmd)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package get
package download

import (
"context"
Expand Down Expand Up @@ -29,7 +29,7 @@ func (o *Opts) AddArgs(cmd *cobra.Command) {

func Cmd(ctx context.Context, o *Opts, reference string) error {
l := log.FromContext(ctx)
l.Debugf("running command `hauler get`")
l.Debugf("running command `hauler download`")

cs := content.NewFileStore(o.DestinationDir)
defer cs.Close()
Expand Down
25 changes: 0 additions & 25 deletions cmd/hauler/cli/get.go

This file was deleted.

29 changes: 0 additions & 29 deletions cmd/hauler/cli/load.go

This file was deleted.

30 changes: 0 additions & 30 deletions cmd/hauler/cli/save.go

This file was deleted.

29 changes: 0 additions & 29 deletions cmd/hauler/cli/serve.go

This file was deleted.

Loading

0 comments on commit 8a46c20

Please sign in to comment.