Skip to content

Commit

Permalink
Adds search command
Browse files Browse the repository at this point in the history
Added support for searching distributions.
Added descriptions in distributions.yml
Added teler
Updated some go.mod packages
  • Loading branch information
leucos committed Oct 28, 2020
1 parent b73f7cd commit eb5479c
Show file tree
Hide file tree
Showing 8 changed files with 346 additions and 38 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ Currently supported distributions are:
- [promtail](https://github.com/grafana/loki/)
- [rancher](https://rancher.com/docs/rancher/v1.6/en/)[^1]
- [tanka](https://github.com/grafana/tanka)
- [teler](https://github.com/kitabisa/teler/)
- [terraform](https://www.hashicorp.com/products/terraform)
- [terragrunt](https://terragrunt.gruntwork.io/)
- [tflint](https://github.com/terraform-linters/tflint/)
Expand Down
1 change: 1 addition & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ selected.`,
completionCmd(),
installCmd(a),
localCmd(a),
searchCmd(a),
uninstallCmd(a),
updateCmd(a),
versionCmd(),
Expand Down
34 changes: 34 additions & 0 deletions cmd/search.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package cmd

import (
"fmt"

"github.com/devops-works/binenv/internal/app"
"github.com/spf13/cobra"
)

// localCmd represents the local command
func searchCmd(a *app.App) *cobra.Command {
cmd := &cobra.Command{
Use: "search [term]",
Short: "Search term in software distributions",
Long: `Search a term in distribution names or descriptions.`,
RunE: func(cmd *cobra.Command, args []string) error {
verbose, _ := cmd.Flags().GetBool("verbose")
a.SetVerbose(verbose)

switch {
case len(args) > 1:
return fmt.Errorf("command requires a single argument")
case len(args) == 0:
a.Search("")
default:
a.Search(args[0])

}
return nil
},
}

return cmd
}
Loading

0 comments on commit eb5479c

Please sign in to comment.