diff options
-rw-r--r-- | auth/auth.go | 2 | ||||
-rw-r--r-- | cmd/list.go | 20 | ||||
-rw-r--r-- | cmd/search.go | 1 | ||||
-rw-r--r-- | cmd/status.go | 1 | ||||
-rw-r--r-- | cmd/version.go | 2 | ||||
-rw-r--r-- | mal/mal.go | 7 |
6 files changed, 19 insertions, 14 deletions
diff --git a/auth/auth.go b/auth/auth.go index be17271..5a768ff 100644 --- a/auth/auth.go +++ b/auth/auth.go @@ -28,7 +28,7 @@ import ( "github.com/zalando/go-keyring" ) -var serviceName string = "macliTesting" // "macli" +var serviceName string = "macli" var userName string func init() { diff --git a/cmd/list.go b/cmd/list.go index 6cb95fb..e6f7f8c 100644 --- a/cmd/list.go +++ b/cmd/list.go @@ -76,14 +76,14 @@ var listCmd = &cobra.Command{ } func init() { - rootCmd.AddCommand(listCmd) - listCmd.Flags().StringP("status", "", "", "Status (leave blank for all)") - listCmd.Flags().StringP("user", "", "@me", "User (@me or blank for self)") - listCmd.Flags().StringP("sort", "", "list_score", "Sort the list") - listCmd.Flags().BoolP("include-nsfw", "", listIncludeNsfw, "Include NSFW results") - listCmd.Flags().BoolVarP(&mangaMode, "manga", "m", false, "Use manga mode") - listCmd.Flags().StringVarP(&mal.Secret, "authentication-token", "t", "", "MyAnimeList authentication token to use (overrides system keyring if any)") - // TODO: implement below 2 flags - // listCmd.Flags().IntVarP(&mal.SearchLength, "list-length", "n", listLength, "Amount of list items to load (default: all)") - // listCmd.Flags().IntVarP(&mal.SearchOffset, "list-offset", "o", listOffset, "Offset for the list") + rootCmd.AddCommand(listCmd) + listCmd.Flags().StringP("status", "", "", "Status (leave blank for all)") + listCmd.Flags().StringP("user", "", "@me", "User (@me or blank for self)") + listCmd.Flags().StringP("sort", "", "list_score", "Sort the list") + listCmd.Flags().BoolP("include-nsfw", "", listIncludeNsfw, "Include NSFW results") + listCmd.Flags().BoolVarP(&mangaMode, "manga", "m", false, "Use manga mode") + listCmd.Flags().StringVarP(&mal.Secret, "authentication-token", "t", "", "MyAnimeList authentication token to use (overrides system keyring if any)") + // TODO: implement below 2 flags + // listCmd.Flags().IntVarP(&mal.SearchLength, "list-length", "n", listLength, "Amount of list items to load (default: all)") + // listCmd.Flags().IntVarP(&mal.SearchOffset, "list-offset", "o", listOffset, "Offset for the list") } diff --git a/cmd/search.go b/cmd/search.go index 76babf4..57f1980 100644 --- a/cmd/search.go +++ b/cmd/search.go @@ -113,7 +113,6 @@ func searchAnime(searchInput string) { } func init() { - fmt.Println("searchInit") rootCmd.AddCommand(searchCmd) searchCmd.Flags().IntVarP(&ui.PromptLength, "prompt-length", "l", promptLength, "Length of select prompt") searchCmd.Flags().BoolVarP(&mangaMode, "manga", "m", false, "Use manga mode") diff --git a/cmd/status.go b/cmd/status.go index 53e93c6..2dc6fee 100644 --- a/cmd/status.go +++ b/cmd/status.go @@ -133,7 +133,6 @@ func setMangaStatus(statusInput, searchInput string) { } func init() { - fmt.Println("statusINit") rootCmd.AddCommand(statusCmd) statusCmd.Flags().StringP("set-value", "s", "", "status to be set") statusCmd.Flags().IntVarP(&ui.PromptLength, "prompt-length", "l", 5, "Length of select prompt") diff --git a/cmd/version.go b/cmd/version.go index a1c3ca2..ec7b5c6 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -24,7 +24,7 @@ import ( "github.com/spf13/cobra" ) -const version string = "no-keyring test" +const version string = "v1.12.1" var versionCmd = &cobra.Command { Use: "version", @@ -61,6 +61,7 @@ func Init() { confSearchLength := viper.Get("searching.search_length") confSearchOffset := viper.Get("searching.search_offset") confSearchNsfw := viper.Get("searching.search_nsfw") + confSecret := viper.Get("auth.token") // if SearchLength is the default value just use the one in config file if any if confSearchLength != nil && SearchLength == 10 { @@ -75,6 +76,12 @@ func Init() { SearchNSFW = confSearchNsfw.(bool) } + /* the secret stored in the config file + * takes precedence on the system keyring */ + if confSecret != nil && confSecret != "" { + Secret = confSecret.(string) + } + // initialise MAL2Go Client(s) animeClient.AuthToken = tk mangaClient.AuthToken = tk |