Documentation ¶
Index ¶
- Variables
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func MustAsset(name string) []byte
- func NewLearnCmd() *cobra.Command
- func NewWebCmd() *cobra.Command
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
Constants ¶
This section is empty.
Variables ¶
var AddFilterCmd = &cobra.Command{ Use: "add-filter <id> <string> [delete|flag|read|save]", Short: "This will take a regex string and try to flag news that matches that filter", RunE: func(cmd *cobra.Command, args []string) error { if len(args) != 3 { return fmt.Errorf("incorrect arguments: %s", cmd.Use) } u := args[0] feedID, err := strconv.ParseInt(u, 10, 64) if err != nil { return err } str := args[1] action, err := mapToAction(args[2]) if err != nil { return fmt.Errorf("unknown input") } s, err := service.NewServiceFromCmd(cmd) if err != nil { return err } return s.AddRegexFilter(feedID, str, action) }, }
var ( ImportFeedSourceFromFileCmd = &cobra.Command{ Use: "import", RunE: func(cmd *cobra.Command, args []string) error { if len(args) != 1 { return fmt.Errorf("first arg is file name") } in, err := opml.NewOPMLFromFile(args[0]) if err != nil { return err } importCount := 0 logErr := func(err error) { if err != nil { fmt.Println(err.Error()) return } importCount++ } s, err := service.NewServiceFromCmd(cmd) if err != nil { return err } for _, out := range flattenOutlines(in.Outlines()) { switch { case out.XMLURL != "": fmt.Println("XML", out.XMLURL) logErr(s.AddFeed(out.XMLURL)) case out.URL != "": fmt.Println("URL", out.URL) logErr(s.AddFeed(out.URL)) case out.HTMLURL != "": fmt.Println("HTML", out.HTMLURL) logErr(s.AddFeed(out.HTMLURL)) } } fmt.Printf("Imported %d feeds\n", importCount) return nil }, } )
var ( RootCmd = &cobra.Command{ Use: os.Args[0], } )
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func NewLearnCmd ¶
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
Types ¶
This section is empty.