Browse Source

update cliv2

master
syui 2 years ago
parent
commit
3c9e3ce253
No known key found for this signature in database GPG Key ID: ED2A0F5F1DA25512
  1. 18
      .github/workflows/releases.yml
  2. 1
      .gitignore
  3. 4
      .travis.yml
  4. 12
      go.mod
  5. 26
      readme.md
  6. 8
      xq.go

18
.github/workflows/releases.yml

@ -0,0 +1,18 @@
name: releases
on:
push:
tags:
- 'v*.*.*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

1
.gitignore

@ -1,2 +1,3 @@
index.xml
xq
go.sum

4
.travis.yml

@ -1,7 +1,7 @@
language: go
go:
- "1.10.x"
- "1.13"
- master
branches:
@ -14,4 +14,4 @@ before_install:
script:
- gox -output "dist/{{.OS}}_{{.Arch}}_{{.Dir}}"
- ghr --username syui --token $GITHUB_TOKEN --replace --debug 0.1 dist/
- ghr --username syui --token $GITHUB_TOKEN --replace --debug 0.2 dist/

12
go.mod

@ -0,0 +1,12 @@
module github.com/syui/xq
go 1.13
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/v2 v2.0.0
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 // indirect
golang.org/x/text v0.3.2 // indirect
)

26
readme.md

@ -1,13 +1,13 @@
## download
```sh
$ go get -v gitlab.com/syui/xq
$ go get -v github.com/syui/xq
```
## use
```sh
$ xq /path/to/rss.xml
$ xq i /path/to/rss.xml
{
"title": "Creating a new theme",
"link": "https://syui.gitlab.io/test-hugo-theme-wave/2016/01/01/creating-a-new-theme/",
@ -18,7 +18,7 @@ $ xq /path/to/rss.xml
## build
```sh
$ git clone https://gitlab.com/syui/xq
$ git clone https://github.com/syui/xq
$ cd xq
$ go build -o xq
$ ./xq
@ -27,27 +27,11 @@ $ ./xq
## example
```sh
$ url=https://syui.gitlab.io/test-hugo-theme-wave/index.xml
$ curl -sSL -H "Accept: application/xml" $url -o index.xml
$ cat index.xml
$ curl -sLO https://syui.cf/hugo-theme-air/index.xml
$ xq ./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"}
```
## link
https://gitlab.com/syui/xq
https://github.com/syui/xq
https://aur.archlinux.org/packages/xq/
## ref
https://github.com/urfave/cli
https://github.com/mmcdole/gofeed
http://yatta47.hateblo.jp/entry/2017/05/21/233522

8
xq.go

@ -4,7 +4,7 @@ import (
"fmt"
"os"
"encoding/json"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
_ "reflect"
gofeed "github.com/mmcdole/gofeed"
)
@ -13,8 +13,7 @@ func App() *cli.App {
app := cli.NewApp()
app.Name = "xq"
app.Usage = "xq /path/to/rss.xml"
app.Version = "0.1.0"
app.Author = "syui"
app.Version = "0.2.0"
return app
}
@ -54,8 +53,7 @@ func Action(c *cli.Context) {
func main() {
app := App()
app.Action = Action
app.Commands = []cli.Command{
app.Commands = []*cli.Command{
{
Name: "item",
Aliases: []string{"i"},

Loading…
Cancel
Save