aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/chapters.go1
-rw-r--r--cmd/episodes.go1
-rw-r--r--cmd/list.go3
-rw-r--r--cmd/login.go2
-rw-r--r--cmd/score.go1
-rw-r--r--cmd/search.go1
-rw-r--r--cmd/seasonals.go3
-rw-r--r--cmd/status.go1
-rw-r--r--cmd/user_info.go1
-rw-r--r--cmd/volumes.go1
-rw-r--r--mal/mal.go7
11 files changed, 17 insertions, 5 deletions
diff --git a/cmd/chapters.go b/cmd/chapters.go
index 6fc062a..2728beb 100644
--- a/cmd/chapters.go
+++ b/cmd/chapters.go
@@ -98,4 +98,5 @@ func init() {
chaptersCmd.Flags().BoolVarP(&mal.SearchNSFW, "search-nsfw", "", false, "Include NSFW-rated items in search results")
chaptersCmd.Flags().BoolVarP(&queryOnlyMode, "query", "q", false, "Query only (don't update data)")
chaptersCmd.Flags().IntVarP(&entryId, "id", "i", -1, "Manually specify the ID of anime/manga (overrides search)")
+ chaptersCmd.Flags().StringVarP(&mal.Secret, "authentication-token", "t", "", "MyAnimeList authentication token to use (overrides system keyring if any)")
}
diff --git a/cmd/episodes.go b/cmd/episodes.go
index 59fa576..e760eff 100644
--- a/cmd/episodes.go
+++ b/cmd/episodes.go
@@ -98,4 +98,5 @@ func init() {
episodesCmd.Flags().BoolVarP(&mal.SearchNSFW, "search-nsfw", "", false, "Include NSFW-rated items in search results")
episodesCmd.Flags().IntVarP(&mal.SearchOffset, "search-offset", "o", 0, "Offset for the search results")
episodesCmd.Flags().IntVarP(&entryId, "id", "i", -1, "Manually specify the ID of anime/manga (overrides search)")
+ episodesCmd.Flags().StringVarP(&mal.Secret, "authentication-token", "t", "", "MyAnimeList authentication token to use (overrides system keyring if any)")
}
diff --git a/cmd/list.go b/cmd/list.go
index b9c82d9..2b9cc57 100644
--- a/cmd/list.go
+++ b/cmd/list.go
@@ -81,5 +81,6 @@ func init() {
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", "", false, "Include NSFW results")
- listCmd.Flags().BoolVarP(&mangaMode, "manga", "m", false, "Use manga mode")
+ 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)")
}
diff --git a/cmd/login.go b/cmd/login.go
index 9eed0a3..9f12d46 100644
--- a/cmd/login.go
+++ b/cmd/login.go
@@ -44,4 +44,6 @@ var loginCmd = &cobra.Command {
func init() {
rootCmd.AddCommand(loginCmd)
+ // TODO: save given token to keyring
+ // rootCmd.Flags().StringVarP(&mal.Secret, "authentication-token", "t", "", "MyAnimeList authentication token to use (overrides system keyring if any)")
}
diff --git a/cmd/score.go b/cmd/score.go
index a4a0439..6a2df9c 100644
--- a/cmd/score.go
+++ b/cmd/score.go
@@ -166,4 +166,5 @@ func init() {
scoreCmd.Flags().BoolVarP(&mangaMode, "manga", "m", false, "Use manga mode")
scoreCmd.Flags().BoolVarP(&queryOnlyMode, "query", "q", false, "Query only (don't update data)")
scoreCmd.Flags().IntVarP(&entryId, "id", "i", -1, "Manually specify the ID of anime/manga (overrides search)")
+ scoreCmd.Flags().StringVarP(&mal.Secret, "authentication-token", "t", "", "MyAnimeList authentication token to use (overrides system keyring if any)")
}
diff --git a/cmd/search.go b/cmd/search.go
index fe6bea2..b6aaf3e 100644
--- a/cmd/search.go
+++ b/cmd/search.go
@@ -121,4 +121,5 @@ func init() {
searchCmd.Flags().BoolVarP(&mal.SearchNSFW, "search-nsfw", "", false, "Include NSFW-rated items in search results")
searchCmd.Flags().IntVarP(&entryId, "id", "i", -1, "Manually specify the ID of anime/manga (overrides search)")
searchCmd.Flags().BoolVarP(&queryOnlyMode, "query", "q", false, "Query only (don't update data)")
+ searchCmd.Flags().StringVarP(&mal.Secret, "authentication-token", "t", "", "MyAnimeList authentication token to use (overrides system keyring if any)")
}
diff --git a/cmd/seasonals.go b/cmd/seasonals.go
index 7169488..7fd4cde 100644
--- a/cmd/seasonals.go
+++ b/cmd/seasonals.go
@@ -60,12 +60,11 @@ func init() {
rootCmd.AddCommand(seasonalsCmd)
seasonalsCmd.Flags().IntVarP(&ui.PromptLength, "prompt-length", "l", 5, "Length of select prompt")
seasonalsCmd.Flags().BoolVarP(&queryOnlyMode, "query", "q", false, "Query only (don't update data)")
-
seasonalsCmd.Flags().IntVarP(&mal.SearchLength, "results-length", "n", 10, "Amount of results to load")
seasonalsCmd.Flags().BoolVarP(&mal.SearchNSFW, "include-nsfw", "", false, "Include NSFW-rated items in results")
seasonalsCmd.Flags().IntVarP(&mal.SearchOffset, "results-offset", "o", 0, "Offset for the results")
-
seasonalsCmd.Flags().StringP("sort", "", "anime_num_list_users", "sort")
seasonalsCmd.Flags().StringP("season", "", "", "")
seasonalsCmd.Flags().IntP("year", "", 0, "")
+ seasonalsCmd.Flags().StringVarP(&mal.Secret, "authentication-token", "t", "", "MyAnimeList authentication token to use (overrides system keyring if any)")
}
diff --git a/cmd/status.go b/cmd/status.go
index c923946..2dc6fee 100644
--- a/cmd/status.go
+++ b/cmd/status.go
@@ -142,4 +142,5 @@ func init() {
statusCmd.Flags().BoolVarP(&mangaMode, "manga", "m", false, "Use manga mode")
statusCmd.Flags().BoolVarP(&queryOnlyMode, "query", "q", false, "Query only (don't update data)")
statusCmd.Flags().IntVarP(&entryId, "id", "i", -1, "Manually specify the ID of anime/manga (overrides search)")
+ statusCmd.Flags().StringVarP(&mal.Secret, "authentication-token", "t", "", "MyAnimeList authentication token to use (overrides system keyring if any)")
}
diff --git a/cmd/user_info.go b/cmd/user_info.go
index b83af8b..f737f89 100644
--- a/cmd/user_info.go
+++ b/cmd/user_info.go
@@ -52,4 +52,5 @@ Currently, MyAnimeList doesn't allow reading of other users' profiles.
func init() {
rootCmd.AddCommand(userInfoCmd)
+ userInfoCmd.Flags().StringVarP(&mal.Secret, "authentication-token", "t", "", "MyAnimeList authentication token to use (overrides system keyring if any)")
}
diff --git a/cmd/volumes.go b/cmd/volumes.go
index aa9ad7a..92b588b 100644
--- a/cmd/volumes.go
+++ b/cmd/volumes.go
@@ -98,4 +98,5 @@ func init() {
volumesCmd.Flags().BoolVarP(&mal.SearchNSFW, "search-nsfw", "", false, "Include NSFW-rated items in search results")
volumesCmd.Flags().BoolVarP(&queryOnlyMode, "query", "q", false, "Query only (don't update data)")
volumesCmd.Flags().IntVarP(&entryId, "id", "i", -1, "Manually specify the ID of manga (overrides search)")
+ volumesCmd.Flags().StringVarP(&mal.Secret, "authentication-token", "t", "", "MyAnimeList authentication token to use (overrides system keyring if any)")
}
diff --git a/mal/mal.go b/mal/mal.go
index cb9665e..77940df 100644
--- a/mal/mal.go
+++ b/mal/mal.go
@@ -28,6 +28,7 @@ import (
)
var (
+ Secret string
animeClient a.Client
mangaClient m.Client
userClient u.Client
@@ -40,8 +41,10 @@ var (
// init() would kill the program prematurely on `macli login` command
func Init() {
- secret := auth.GetToken()
- tk := "Bearer " + secret
+ if Secret == "" {
+ Secret = auth.GetToken()
+ }
+ tk := "Bearer " + Secret
// initialise MAL2Go Client(s)
animeClient.AuthToken = tk