Skip to content

Commit

Permalink
fix: rename variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
lpsm-dev committed Jun 17, 2022
1 parent f72d9b4 commit 3f816db
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 30 deletions.
2 changes: 0 additions & 2 deletions commands/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ import (
"github.com/spf13/cobra"
)

// excludeDesc description will not be added if true.
var excludeDesc = false

// completionCmd represents the completion command.
var completionCmd = &cobra.Command{
Use: "completion <shell>",
Short: "Generate shell completion scripts",
Expand Down
11 changes: 4 additions & 7 deletions commands/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@ import (
"github.com/spf13/cobra"
)

var (
searchPretty bool // Local flag - if true show more details about the search.
)
var searchPretty bool

// SearchCmd represents the search command
var SearchCmd = &cobra.Command{
var searchCmd = &cobra.Command{
Use: "search",
Aliases: []string{"find"},
Short: "Perform the search for an anime",
Long: ``,
}

func init() {
SearchCmd.PersistentFlags().BoolVarP(&searchPretty, "pretty", "p", false, "Pretty output")
rootCmd.AddCommand(SearchCmd)
searchCmd.PersistentFlags().BoolVarP(&searchPretty, "pretty", "p", false, "Pretty output")
rootCmd.AddCommand(searchCmd)
}
9 changes: 4 additions & 5 deletions commands/search_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import (

var animeFile string

// SearchFileCmd represents the search command
var SearchFileCmd = &cobra.Command{
var searchFileCmd = &cobra.Command{
Use: "file",
Short: "Search for the anime scene by existing image file",
Long: ``,
Expand All @@ -18,7 +17,7 @@ var SearchFileCmd = &cobra.Command{
}

func init() {
SearchFileCmd.PersistentFlags().StringVarP(&animeFile, "file", "f", animeFile, "An anime image file")
SearchFileCmd.MarkFlagRequired("file")
SearchCmd.AddCommand(SearchFileCmd)
searchFileCmd.PersistentFlags().StringVarP(&animeFile, "file", "f", animeFile, "An anime image file")
searchFileCmd.MarkFlagRequired("file")
searchCmd.AddCommand(searchFileCmd)
}
9 changes: 4 additions & 5 deletions commands/search_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import (

var animeLink string

// SearchLinkCmd represents the search command
var SearchLinkCmd = &cobra.Command{
var searchLinkCmd = &cobra.Command{
Use: "link",
Short: "Search for the anime scene by existing image link",
Long: ``,
Expand All @@ -18,7 +17,7 @@ var SearchLinkCmd = &cobra.Command{
}

func init() {
SearchLinkCmd.PersistentFlags().StringVarP(&animeLink, "url", "u", animeLink, "An anime image url")
SearchLinkCmd.MarkFlagRequired("link")
SearchCmd.AddCommand(SearchLinkCmd)
searchLinkCmd.PersistentFlags().StringVarP(&animeLink, "url", "u", animeLink, "An anime image url")
searchLinkCmd.MarkFlagRequired("link")
searchCmd.AddCommand(searchLinkCmd)
}
5 changes: 2 additions & 3 deletions commands/search_usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import (
"github.com/spf13/cobra"
)

// SearchMeCmd represents the search command
var SearchMeCmd = &cobra.Command{
var searchMeCmd = &cobra.Command{
Use: "usage",
Short: "Check the search quota and limit for your account (with API key) or IP address (without API key)",
Long: ``,
Expand All @@ -16,5 +15,5 @@ var SearchMeCmd = &cobra.Command{
}

func init() {
SearchCmd.AddCommand(SearchMeCmd)
searchCmd.AddCommand(searchMeCmd)
}
6 changes: 2 additions & 4 deletions commands/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import (
"github.com/spf13/cobra"
)

// UpgradeCmd downloads and installs the most recent version of the CLI.
var UpgradeCmd = &cobra.Command{
var upgradeCmd = &cobra.Command{
Use: "upgrade",
Aliases: []string{"u"},
Short: "Upgrade to the latest version of the CLI.",
Expand All @@ -32,7 +31,6 @@ You can always delete this file.
},
}

// updateCLI updates CLI to the latest available version, if it is out of date.
func updateCLI(c cli.Updater) error {
ok, err := c.IsUpToDate()
if err != nil {
Expand All @@ -48,5 +46,5 @@ func updateCLI(c cli.Updater) error {
}

func init() {
rootCmd.AddCommand(UpgradeCmd)
rootCmd.AddCommand(upgradeCmd)
}
8 changes: 4 additions & 4 deletions commands/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

var short, full bool

var VersionCmd = &cobra.Command{
var versionCmd = &cobra.Command{
Use: "version",
Aliases: []string{"v"},
Short: "Version outputs the version of CLI",
Expand All @@ -22,7 +22,7 @@ var VersionCmd = &cobra.Command{
}

func init() {
VersionCmd.PersistentFlags().BoolVarP(&short, "short", "s", false, "Show short details about the current version of loli CLI")
VersionCmd.PersistentFlags().BoolVarP(&full, "full", "f", false, "Show full details about the current version of loli CLI")
rootCmd.AddCommand(VersionCmd)
versionCmd.PersistentFlags().BoolVarP(&short, "short", "s", false, "Show short details about the current version of loli CLI")
versionCmd.PersistentFlags().BoolVarP(&full, "full", "f", false, "Show full details about the current version of loli CLI")
rootCmd.AddCommand(versionCmd)
}

0 comments on commit 3f816db

Please sign in to comment.