-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: show read in binds help * build: add `.deb` and `.rpm` packages, update deps * build: enable upload * build: bump version * refactor: move custom sources to providers * refactor: move custom sources to providers * refactor(where cmd): show flag suggestion * refactor: move read/download chapter to a single place * feat: inline mode added * feat: add regex for inline mode * docs: add inline mode docs * build: bump version * refactor: remove icons on sources cmd * feat: option to choose default source added * fix: flags short names * docs: small README changes
- Loading branch information
Showing
35 changed files
with
885 additions
and
570 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,3 +84,21 @@ release: | |
draft: false | ||
name_template: "{{.ProjectName}} v{{.Version}}" | ||
|
||
nfpms: | ||
- | ||
file_name_template: "{{ .ConventionalFileName }}" | ||
homepage: https://github.com/metafates/mangal | ||
maintainer: metafates <[email protected]> | ||
description: |- | ||
The most advanced cli manga downloader in the entire universe! | ||
license: MIT | ||
formats: | ||
- deb | ||
- rpm | ||
|
||
bindir: /usr/bin | ||
|
||
rpm: | ||
group: Unspecified | ||
compression: lzma |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"github.com/metafates/mangal/inline" | ||
"github.com/metafates/mangal/provider" | ||
"github.com/samber/lo" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func init() { | ||
rootCmd.AddCommand(inlineCmd) | ||
|
||
inlineCmd.Flags().String("source", "", "source to use. see `mangal sources` for available sources") | ||
inlineCmd.Flags().String("query", "", "query to search for") | ||
inlineCmd.Flags().String("manga", "", "manga selector") | ||
inlineCmd.Flags().String("chapters", "", "chapter selector") | ||
inlineCmd.Flags().BoolP("download", "d", false, "download chapters") | ||
|
||
lo.Must0(inlineCmd.MarkFlagRequired("source")) | ||
lo.Must0(inlineCmd.MarkFlagRequired("query")) | ||
lo.Must0(inlineCmd.MarkFlagRequired("manga")) | ||
lo.Must0(inlineCmd.MarkFlagRequired("chapters")) | ||
} | ||
|
||
var inlineCmd = &cobra.Command{ | ||
Use: "inline", | ||
Short: "Launch in the inline mode", | ||
Long: `Launch in the inline mode for scripting | ||
Manga selectors: | ||
first - first manga in the list | ||
last - last manga in the list | ||
[number] - select manga by index | ||
Chapter selectors: | ||
first - first chapter in the list | ||
last - last chapter in the list | ||
all - all chapters in the list | ||
[number] - select chapter by index | ||
[from]-[to] - select chapters by range | ||
@[substring]@ - select chapters by name substring`, | ||
Example: "mangal inline --source Manganelo --query \"death note\" --manga first --chapters \"@Vol.1 @\" -d", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
sourceName := lo.Must(cmd.Flags().GetString("source")) | ||
p, ok := provider.Get(sourceName) | ||
if !ok { | ||
return fmt.Errorf("source not found: %s", sourceName) | ||
} | ||
|
||
src, err := p.CreateSource() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
mangaPicker, err := inline.ParseMangaPicker(lo.Must(cmd.Flags().GetString("manga"))) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
chapterFilter, err := inline.ParseChaptersFilter(lo.Must(cmd.Flags().GetString("chapters"))) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
options := &inline.Options{ | ||
Source: src, | ||
Download: lo.Must(cmd.Flags().GetBool("download")), | ||
Query: lo.Must(cmd.Flags().GetString("query")), | ||
MangaPicker: mangaPicker, | ||
ChapterFilter: chapterFilter, | ||
} | ||
|
||
return inline.Run(options) | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.