Skip to content

Commit

Permalink
Added curr command that prints details about currently selected entry
Browse files Browse the repository at this point in the history
  • Loading branch information
aQaTL committed Jan 28, 2019
1 parent 6893443 commit 819f424
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion anilist_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ func AniListApp(app *cli.App) *cli.App {
UsageText: "mal sel [entry title]",
Action: alSelectEntry,
},
cli.Command{
Name: "selected",
Aliases: []string{"curr"},
Category: "Action",
Usage: "Display info about currently selected entry",
UsageText: "mal curr",
Action: alShowSelectedEntry,
},
cli.Command{
Name: "nyaa",
Aliases: []string{"n"},
Expand Down Expand Up @@ -292,7 +300,7 @@ func aniListDefaultAction(ctx *cli.Context) error {

var visibleEntries int
if visibleEntries = ctx.Int("max"); visibleEntries == 0 {
//`Max` flag not specified, get value from config
// `Max` flag not specified, get value from config
visibleEntries = cfg.MaxVisibleEntries
}
if visibleEntries > len(list) || visibleEntries < 0 || ctx.Bool("all") {
Expand Down Expand Up @@ -495,6 +503,15 @@ func alSaveSelection(cfg *Config, entry *anilist.MediaListEntry) {
alPrintEntryDetails(entry)
}

func alShowSelectedEntry(ctx *cli.Context) error {
_, entry, _, err := loadAniListFull(ctx)
if err != nil {
return err
}
alPrintEntryDetails(entry)
return nil
}

func alNyaaWebsite(ctx *cli.Context) error {
al, err := loadAniList(ctx)
if err != nil {
Expand Down

0 comments on commit 819f424

Please sign in to comment.