diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/actions.go | 13 | ||||
-rw-r--r-- | ui/episodes.go | 11 | ||||
-rw-r--r-- | ui/list.go | 7 | ||||
-rw-r--r-- | ui/score.go | 11 | ||||
-rw-r--r-- | ui/search.go | 9 | ||||
-rw-r--r-- | ui/status.go | 9 | ||||
-rw-r--r-- | ui/ui.go | 2 |
7 files changed, 28 insertions, 34 deletions
diff --git a/ui/actions.go b/ui/actions.go index b626457..2c5d757 100644 --- a/ui/actions.go +++ b/ui/actions.go @@ -23,24 +23,23 @@ import ( "fmt" "os" p "github.com/manifoldco/promptui" - a "github.com/MikunoNaka/MAL2Go/v4/anime" - m "github.com/MikunoNaka/MAL2Go/v4/manga" - "github.com/MikunoNaka/macli/mal" + "vidhukant.com/mg" + "vidhukant.com/macli/mal" ) type AnimeAction struct { Label string Description string - Method func(a.Anime) + Method func(mg.Anime) } type MangaAction struct { Label string Description string - Method func(m.Manga) + Method func(mg.Manga) } -func AnimeActionMenu(animeIsAdded bool) func(a.Anime) { +func AnimeActionMenu(animeIsAdded bool) func(mg.Anime) { options := []AnimeAction { {"Set Status", "Set status for an anime (watching, dropped, etc)", AnimeStatusMenu}, {"Set Episodes", "Set number of episodes watched", EpisodeInput}, @@ -92,7 +91,7 @@ func AnimeActionMenu(animeIsAdded bool) func(a.Anime) { return options[res].Method } -func MangaActionMenu(mangaIsAdded bool) func(m.Manga) { +func MangaActionMenu(mangaIsAdded bool) func(mg.Manga) { options := []MangaAction { {"Set Status", "Set status for a manga (reading, dropped, etc)", MangaStatusMenu}, {"Set Chapters", "Set number of chapters read", ChapterInput}, diff --git a/ui/episodes.go b/ui/episodes.go index b4137ed..182952c 100644 --- a/ui/episodes.go +++ b/ui/episodes.go @@ -23,9 +23,8 @@ import ( "fmt" "os" "errors" - "github.com/MikunoNaka/macli/mal" - a "github.com/MikunoNaka/MAL2Go/v4/anime" - m "github.com/MikunoNaka/MAL2Go/v4/manga" + "vidhukant.com/macli/mal" + "vidhukant.com/mg" p "github.com/manifoldco/promptui" ) @@ -51,7 +50,7 @@ func CreateVolumeUpdateConfirmationMessage(title string, volNum, prevVolNum int) return fmt.Sprintf("\x1b[35m%s\x1b[0m Volumes Read :: \x1b[1;36m%d\x1b[0m", title, volNum) } -func EpisodeInput(anime a.Anime) { +func EpisodeInput(anime mg.Anime) { epWatchedNum := anime.MyListStatus.EpWatched epTotalNum := anime.NumEpisodes @@ -84,7 +83,7 @@ func EpisodeInput(anime a.Anime) { fmt.Println(CreateEpisodeUpdateConfirmationMessage(anime.Title, resp.EpWatched, epWatchedNum)) } -func ChapterInput(manga m.Manga) { +func ChapterInput(manga mg.Manga) { chReadNum := manga.MyListStatus.ChaptersRead chTotalNum := manga.NumChapters @@ -117,7 +116,7 @@ func ChapterInput(manga m.Manga) { fmt.Println(CreateChapterUpdateConfirmationMessage(manga.Title, resp.ChaptersRead, chReadNum)) } -func VolumeInput(manga m.Manga) { +func VolumeInput(manga mg.Manga) { volReadNum := manga.MyListStatus.VolumesRead volTotalNum := manga.NumVolumes @@ -19,14 +19,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. package ui import ( - a "github.com/MikunoNaka/MAL2Go/v4/anime" - m "github.com/MikunoNaka/MAL2Go/v4/manga" + "vidhukant.com/mg" "github.com/jedib0t/go-pretty/v6/table" "fmt" "os" ) -func AnimeList(animes []a.Anime) { +func AnimeList(animes []mg.Anime) { t := table.NewWriter() t.SetOutputMirror(os.Stdout) @@ -52,7 +51,7 @@ func AnimeList(animes []a.Anime) { t.Render() } -func MangaList(mangas []m.Manga) { +func MangaList(mangas []mg.Manga) { t := table.NewWriter() t.SetOutputMirror(os.Stdout) diff --git a/ui/score.go b/ui/score.go index c0b4fcb..afa40ca 100644 --- a/ui/score.go +++ b/ui/score.go @@ -23,10 +23,9 @@ import ( "errors" "fmt" "os" - "github.com/MikunoNaka/macli/mal" - "github.com/MikunoNaka/macli/util" - m "github.com/MikunoNaka/MAL2Go/v4/manga" - a "github.com/MikunoNaka/MAL2Go/v4/anime" + "vidhukant.com/macli/mal" + "vidhukant.com/macli/util" + "vidhukant.com/mg" p "github.com/manifoldco/promptui" ) @@ -72,7 +71,7 @@ func CreateScoreUpdateConfirmationMessage(title string, score, prevScore int) st return fmt.Sprintf("\x1b[35m%s\x1b[0m Score :: %s", title, FormatScore(score)) } -func AnimeScoreInput(anime a.Anime) { +func AnimeScoreInput(anime mg.Anime) { currentScore := anime.MyListStatus.Score validate := func(input string) error { i, err := strconv.ParseFloat(input, 64) @@ -111,7 +110,7 @@ func AnimeScoreInput(anime a.Anime) { fmt.Println(CreateScoreUpdateConfirmationMessage(anime.Title, resp.Score ,currentScore)) } -func MangaScoreInput(manga m.Manga) { +func MangaScoreInput(manga mg.Manga) { currentScore := manga.MyListStatus.Score validate := func(input string) error { diff --git a/ui/search.go b/ui/search.go index a8e8f51..e492e05 100644 --- a/ui/search.go +++ b/ui/search.go @@ -23,9 +23,8 @@ import ( "fmt" "os" p "github.com/manifoldco/promptui" - mal "github.com/MikunoNaka/macli/mal" - a "github.com/MikunoNaka/MAL2Go/v4/anime" - m "github.com/MikunoNaka/MAL2Go/v4/manga" + "vidhukant.com/macli/mal" + "vidhukant.com/mg" ) var AnimeSearchFields []string = []string { @@ -38,7 +37,7 @@ var AnimeSearchFields []string = []string { } // only search animes probably only now -func AnimeSearch(label, searchString string) a.Anime { +func AnimeSearch(label, searchString string) mg.Anime { animes := mal.SearchAnime(searchString, AnimeSearchFields) // don't show selection prompt if --auto-select is passed if mal.AutoSel > 0 { @@ -155,7 +154,7 @@ var MangaSearchFields []string = []string { "media_type", "status", "authors", } -func MangaSearch(label, searchString string) m.Manga { +func MangaSearch(label, searchString string) mg.Manga { mangas := mal.SearchManga(searchString, MangaSearchFields) // don't show selection prompt if --auto-select is passed if mal.AutoSel > 0 { diff --git a/ui/status.go b/ui/status.go index d54f07e..cd840d6 100644 --- a/ui/status.go +++ b/ui/status.go @@ -22,9 +22,8 @@ import ( "strings" "fmt" "os" - "github.com/MikunoNaka/macli/mal" - a "github.com/MikunoNaka/MAL2Go/v4/anime" - m "github.com/MikunoNaka/MAL2Go/v4/manga" + "vidhukant.com/macli/mal" + "vidhukant.com/mg" p "github.com/manifoldco/promptui" ) @@ -84,7 +83,7 @@ func CreateStatusUpdateConfirmationMessage(title, status, prevStatus string) str return "\x1b[35m" + title + "\x1b[0m Status :: " + GetColorCodeByStatus(status) + FormatStatus(status) + "\x1b[0m" } -func AnimeStatusMenu(anime a.Anime) { +func AnimeStatusMenu(anime mg.Anime) { options := []StatusOption { {"Watching", "watching"}, {"Completed", "completed"}, @@ -140,7 +139,7 @@ func AnimeStatusMenu(anime a.Anime) { fmt.Println(CreateStatusUpdateConfirmationMessage(anime.Title, resp.Status, anime.MyListStatus.Status)) } -func MangaStatusMenu(manga m.Manga) { +func MangaStatusMenu(manga mg.Manga) { options := []StatusOption { {"Reading", "reading"}, {"Completed", "completed"}, @@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. package ui import ( - "github.com/spf13/viper" + "github.com/spf13/viper" ) var PromptLength int |