Browse Source

update 0.2.2

master
syui 2 years ago
parent
commit
b238a1e483
No known key found for this signature in database GPG Key ID: ED2A0F5F1DA25512
  1. 2
      .travis.yml
  2. 6
      readme.md
  3. 24
      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.1 dist/
- ghr --username syui --token $GITHUB_TOKEN --replace --debug 0.2.2 dist/

6
readme.md

@ -29,9 +29,7 @@ $ ./xq
```sh
$ curl -sLO https://syui.cf/hugo-theme-air/index.xml
$ xq i ./index.xml
{"title":"Creating a new theme","link":"https://syui.gitlab.io/test-hugo-theme-wave/2016/01/01/creating-a-new-theme/","date":"2018-01-16T00:00:00.000+09:00"}
{"title":"Archive","link":"https://syui.gitlab.io/test-hugo-theme-wave/archive/","date":"2018-01-16T00:00:00.000+09:00"}
$ xq a ./index.xml
[{"title":"Creating a new theme","link":"https://syui.gitlab.io/test-hugo-theme-wave/2016/01/01/creating-a-new-theme/","date":"2018-01-16T00:00:00.000+09:00"}, {"title":"Archive","link":"https://syui.gitlab.io/test-hugo-theme-wave/archive/","date":"2018-01-16T00:00:00.000+09:00"}]
```

24
xq.go

@ -13,7 +13,7 @@ func App() *cli.App {
app := cli.NewApp()
app.Name = "xq"
app.Usage = "xq a /path/to/rss.xml"
app.Version = "0.2.1"
app.Version = "0.2.2"
return app
}
@ -66,9 +66,9 @@ func main() {
},
},
{
Name: "latest",
Aliases: []string{"l"},
Usage: "xq l ./index.xml #latest updated",
Name: "update",
Aliases: []string{"u","l"},
Usage: "xq u ./index.xml #latest updated",
Action: func(c *cli.Context) error {
file, _ := os.Open(c.Args().First())
defer file.Close()
@ -78,10 +78,24 @@ func main() {
return nil
},
},
{
Name: "publish",
Aliases: []string{"p"},
Usage: "xq p ./index.xml #latest items published",
Action: func(c *cli.Context) error {
file, _ := os.Open(c.Args().First())
defer file.Close()
fp := gofeed.NewParser()
feed, _ := fp.Parse(file)
item := feed.Items[0].Published
fmt.Printf("%s\n",item)
return nil
},
},
{
Name: "all",
Aliases: []string{"a"},
Usage: "xq a ./index.xml",
Usage: "xq a ./index.xml #json",
Action: func(c *cli.Context) error {
file, _ := os.Open(c.Args().First())
defer file.Close()

Loading…
Cancel
Save