-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for searching distributions. Added descriptions in distributions.yml Added teler Updated some go.mod packages
- Loading branch information
Showing
8 changed files
with
346 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
Oops, something went wrong.