Browse Source

update 0.3.0

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

27
readme.md

@ -17,7 +17,7 @@ $ xq /path/to/rss.xml
$ git clone https://github.com/syui/xq
$ cd xq
$ go build -o xq
$ ./xq
$ ./xq h
```
## example
@ -31,17 +31,36 @@ $ xq i ./index.xml
"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"
}
# latest item link
$ xq l link index.xml
https://syui.gitlab.io/test-hugo-theme-wave/2016/01/01/creating-a-new-theme/
# latest item title
$ xq l title index.xml
Creating a new theme
# latest item publish
$ xq l published index.xml
$ xq p index.xml
2018-01-16T00:00:00.000+09:00
# latest update
$ xq u index.xml
2018-01-16T00:00:00.000+09:00
```
## update
- 0.2.0 : urfave/cli/v2
- 0.2.1 : option/[a]ll(json)
- 0.2.1 : option/[a]ll
- 0.2.2 : option/publish
- 0.2.2 : option/[p]ublish
- 0.2.3 : fix option/[i]tem(json)
- 0.2.3 : fix option/[i]tem
- 0.2.4 : option/none, $ xq file
- 0.3.0 : option/[l]atest, sub-command/{link, title, published, description}, $ xq l link ./index.xml

56
xq.go

@ -13,7 +13,7 @@ func App() *cli.App {
app := cli.NewApp()
app.Name = "xq"
app.Usage = "xq /path/to/rss.xml"
app.Version = "0.2.4"
app.Version = "0.3.0"
return app
}
@ -96,6 +96,60 @@ func main() {
Name: "update",
Aliases: []string{"u","l"},
Usage: "xq u ./index.xml #latest updated",
Subcommands: []*cli.Command{
{
Name: "link",
Usage: "xq l link ./index.xml #latest item link",
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].Link
fmt.Printf("%s\n",item)
return nil
},
},
{
Name: "title",
Usage: "xq l title ./index.xml #latest itme title",
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].Title
fmt.Printf("%s\n",item)
return nil
},
},
{
Name: "description",
Usage: "xq l description ./index.xml #latest itme description",
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].Description
fmt.Printf("%s\n",item)
return nil
},
},
{
Name: "published",
Usage: "xq l published ./index.xml #latest itme 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
},
},
},
Action: func(c *cli.Context) error {
file, _ := os.Open(c.Args().First())
defer file.Close()

Loading…
Cancel
Save