Browse Source

change option all

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

5
readme.md

@ -89,6 +89,9 @@ $ xq l d index.xml
- 0.3.0 : option/[l]atest, sub-command/{link, title, published, description}, $ xq l link ./index.xml
- 0.3.1 : fix version, $ xq v
- 0.3.1 : fix version, $ xq -v
- 0.3.2 : add alias sub-command, $ xq l d ./index.xml
- 0.3.3 : change option/all, $ xq a ./index.xml

12
xq.go

@ -41,9 +41,9 @@ func Action(c *cli.Context) {
func main() {
app := &cli.App{
Version: "0.3.2",
Version: "0.3.3",
Name: "xq",
Usage: "$ xq index.xml",
Usage: "$ xq index.xml #xml -> json",
Action: func(c *cli.Context) error {
if c.Args().Get(0) == "" {
help := []string{"xq", "--help"}
@ -180,18 +180,14 @@ func main() {
{
Name: "all",
Aliases: []string{"a"},
Usage: "xq a ./index.xml #json",
Usage: "xq a ./index.xml #src date",
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))
fmt.Printf("%s", items)
return nil
},
},

Loading…
Cancel
Save