Skip to content

Commit

Permalink
add ability to specify binaries for ensure command (#168)
Browse files Browse the repository at this point in the history
fixes #167

Signed-off-by: Marcos Lilljedahl <[email protected]>
  • Loading branch information
marcosnils authored Jul 19, 2023
1 parent 10f4bcd commit 00e1249
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions cmd/ensure.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,27 @@ func newEnsureCmd() *ensureCmd {
root := &ensureCmd{}
// nolint: dupl
cmd := &cobra.Command{
Use: "ensure",
Use: "ensure [binary_path]...",
Aliases: []string{"e"},
Short: "Ensures that all binaries listed in the configuration are present",
SilenceUsage: true,
Args: cobra.MaximumNArgs(0),
SilenceErrors: true,
RunE: func(cmd *cobra.Command, args []string) error {
cfg := config.Get()
binsToProcess := cfg.Bins
binsToProcess := map[string]*config.Binary{}

// Update specific binaries
if len(args) > 0 {
for _, a := range args {
bin, err := getBinPath(a)
if err != nil {
return err
}
binsToProcess[bin] = cfg.Bins[bin]
}
} else {
binsToProcess = cfg.Bins
}

// TODO: code smell here, this pretty much does
// the same thing as install logic. Refactor to
Expand Down

0 comments on commit 00e1249

Please sign in to comment.