Skip to content

Commit

Permalink
change option all
Browse files Browse the repository at this point in the history
  • Loading branch information
syui committed Dec 24, 2019
1 parent a6bdfef commit c8f20ce
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,6 @@ $ xq l d index.xml
- 0.3.1 : fix version, $ xq v

- 0.3.2 : add alias sub-command, $ xq l d ./index.xml

- 0.3.3 : fix option/all, $ xq a ./index.xml

12 changes: 4 additions & 8 deletions xq.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down Expand Up @@ -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
},
},
Expand Down

0 comments on commit c8f20ce

Please sign in to comment.