Browse Source

update 0.2.1

master
syui 2 years ago
parent
commit
1d7847b834
No known key found for this signature in database GPG Key ID: ED2A0F5F1DA25512
  1. 2
      .travis.yml
  2. 1
      go.mod
  3. 33
      xq.go

2
.travis.yml

@ -14,4 +14,4 @@ before_install:
script:
- gox -output "dist/{{.OS}}_{{.Arch}}_{{.Dir}}"
- ghr --username syui --token $GITHUB_TOKEN --replace --debug 0.2 dist/
- ghr --username syui --token $GITHUB_TOKEN --replace --debug 0.2.1 dist/

1
go.mod

@ -6,6 +6,7 @@ require (
github.com/PuerkitoBio/goquery v1.5.0 // indirect
github.com/mmcdole/gofeed v1.0.0-beta2
github.com/mmcdole/goxpp v0.0.0-20181012175147-0068e33feabf // indirect
github.com/urfave/cli v1.22.2
github.com/urfave/cli/v2 v2.0.0
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 // indirect
golang.org/x/text v0.3.2 // indirect

33
xq.go

@ -12,8 +12,8 @@ import (
func App() *cli.App {
app := cli.NewApp()
app.Name = "xq"
app.Usage = "xq /path/to/rss.xml"
app.Version = "0.2.0"
app.Usage = "xq a /path/to/rss.xml"
app.Version = "0.2.1"
return app
}
@ -36,17 +36,6 @@ func Action(c *cli.Context) {
help := []string{"", "--help"}
app.Run(help)
os.Exit(1)
} else {
file, _ := os.Open(c.Args().First())
defer file.Close()
fp := gofeed.NewParser()
feed, _ := fp.Parse(file)
items := feed.Items
outputJson, err := json.Marshal(&items)
if err != nil {
panic(err)
}
fmt.Printf("%s", string(outputJson))
}
return
}
@ -89,6 +78,24 @@ func main() {
return nil
},
},
{
Name: "all",
Aliases: []string{"a"},
Usage: "xq a ./index.xml",
Action: func(c *cli.Context) error {
file, _ := os.Open(c.Args().First())
defer file.Close()
fp := gofeed.NewParser()
feed, _ := fp.Parse(file)
items := feed.Items
outputJson, err := json.Marshal(&items)
if err != nil {
panic(err)
}
fmt.Printf("%s", string(outputJson))
return nil
},
},
}
app.Run(os.Args)
}

Loading…
Cancel
Save