Skip to content

Commit 40e3a96

Browse files
committed
Merge branch 'develop'
2 parents f9df44f + a29d1ab commit 40e3a96

File tree

16 files changed

+235
-170
lines changed

16 files changed

+235
-170
lines changed

.circleci/config.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Main
2+
3+
on:
4+
push:
5+
branches: ['*']
6+
pull_request:
7+
branches: ['*']
8+
9+
jobs:
10+
main:
11+
name: Main
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
- name: Setup Go
18+
uses: actions/setup-go@v2
19+
with:
20+
go-version: 1.16
21+
- name: Get dependencies
22+
run: make deps
23+
- name: Build
24+
run: make
25+
- name: Test
26+
run: go test

Makefile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ cross-build:
2323
done
2424

2525
.PHONY: deps
26-
deps: glide
27-
glide install
26+
deps:
27+
go mod download
2828

2929
.PHONY: dist
3030
dist:
@@ -39,12 +39,6 @@ dist:
3939
build:
4040
go build $(LDFLAGS) -o bin/$(NAME)
4141

42-
.PHONY: glide
43-
glide:
44-
ifeq ($(shell command -v glide 2> /dev/null),)
45-
curl https://glide.sh/get | sh
46-
endif
47-
4842
.PHONY: install
4943
install:
5044
go install $(LDFLAGS)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ Section name is utilized as profile name. In each section following key setting
5353
| username | username for password grant | (none) | (any) | no (except for password grant) |
5454
| password | password for password grant | (none) | (any) | no (except for password grant) |
5555
| default\_content\_type | default content type header | (none) | (any) | no |
56+
| default\_user\_agent | default user agent header | aurl x.x.x | (any) | no |
5657

5758

5859
Implicit flow is not supported currently.

cli.go

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package main
22

33
import (
4-
"log"
54
"io"
65
"io/ioutil"
7-
"gopkg.in/alecthomas/kingpin.v2"
8-
"github.com/classmethod/aurl/request"
6+
"log"
7+
98
"github.com/classmethod/aurl/profiles"
9+
"github.com/classmethod/aurl/request"
10+
version "github.com/classmethod/aurl/version"
11+
"gopkg.in/alecthomas/kingpin.v2"
1012
)
1113

1214
// Exit codes are int values that represent an exit code for a particular error.
@@ -23,25 +25,23 @@ type CLI struct {
2325
}
2426

2527
var (
26-
profileName = kingpin.Flag("profile", "Set profile name. (default: \"default\")").Short('p').Default("default").String()
27-
method = kingpin.Flag("request", "Set HTTP request method. (default: \"GET\")").Short('X').Default("GET").String()
28-
headers = HTTPHeader(kingpin.Flag("header", "Add HTTP headers to the request.").Short('H').PlaceHolder("HEADER:VALUE"))
29-
data = kingpin.Flag("data", "Set HTTP request body.").Short('d').String()
30-
insecure = kingpin.Flag("insecure", "Disable SSL certificate verification.").Short('k').Bool()
31-
printBody = kingpin.Flag("print-body", "Enable printing response body to stdout. (default: enabled, try --no-print-body)").Default("true").Bool()
32-
printHeaders = kingpin.Flag("print-headers", "Enable printing response headers JSON to stdout. (default: disabled, try --no-print-headers)").Bool()
33-
verbose = kingpin.Flag("verbose", "Enable verbose logging to stderr.").Short('v').Bool()
28+
profileName = kingpin.Flag("profile", "Set profile name. (default: \"default\")").Short('p').Default("default").String()
29+
method = kingpin.Flag("request", "Set HTTP request method. (default: \"GET\")").Short('X').Default("GET").String()
30+
headers = HTTPHeader(kingpin.Flag("header", "Add HTTP headers to the request.").Short('H').PlaceHolder("HEADER:VALUE"))
31+
data = kingpin.Flag("data", "Set HTTP request body.").Short('d').String()
32+
insecure = kingpin.Flag("insecure", "Disable SSL certificate verification.").Short('k').Bool()
33+
printBody = kingpin.Flag("print-body", "Enable printing response body to stdout. (default: enabled, try --no-print-body)").Default("true").Bool()
34+
printHeaders = kingpin.Flag("print-headers", "Enable printing response headers JSON to stdout. (default: disabled, try --no-print-headers)").Bool()
35+
verbose = kingpin.Flag("verbose", "Enable verbose logging to stderr.").Short('v').Bool()
3436

35-
targetUrl = kingpin.Arg("url", "The URL to request").Required().String()
37+
targetUrl = kingpin.Arg("url", "The URL to request").Required().String()
3638
)
3739

38-
39-
4040
// Run invokes the CLI with the given arguments.
4141
func (cli *CLI) Run(args []string) int {
42-
kingpin.UsageTemplate(kingpin.CompactUsageTemplate).Version(Version).Author(Author)
43-
kingpin.CommandLine.GetFlag("version").Short('V')
44-
kingpin.CommandLine.GetFlag("help").Short('h')
42+
kingpin.UsageTemplate(kingpin.CompactUsageTemplate).Version(version.Version).Author(version.Author)
43+
kingpin.CommandLine.VersionFlag.Short('V')
44+
kingpin.CommandLine.HelpFlag.Short('h')
4545
kingpin.CommandLine.Help = "Command line utility to make HTTP request with OAuth2."
4646
kingpin.Parse()
4747

@@ -69,15 +69,15 @@ func (cli *CLI) Run(args []string) int {
6969
return ExitCodeError
7070
} else {
7171
execution := &request.AurlExecution{
72-
Name: Name,
73-
Version: Version,
72+
Name: version.Name,
73+
Version: version.Version,
7474

75-
Profile: profile,
76-
Method: method,
77-
Headers: headers,
78-
Data: data,
79-
Insecure: insecure,
80-
PrintBody: printBody,
75+
Profile: profile,
76+
Method: method,
77+
Headers: headers,
78+
Data: data,
79+
Insecure: insecure,
80+
PrintBody: printBody,
8181
PrintHeaders: printHeaders,
8282

8383
TargetUrl: targetUrl,

glide.lock

Lines changed: 0 additions & 18 deletions
This file was deleted.

glide.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.

go.mod

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module github.com/classmethod/aurl
2+
3+
go 1.14
4+
5+
require (
6+
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 // indirect
7+
github.com/alecthomas/colour v0.1.0 // indirect
8+
github.com/alecthomas/repr v0.0.0-20210301060118-828286944d6a // indirect
9+
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc // indirect
10+
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf // indirect
11+
github.com/mattn/go-isatty v0.0.12 // indirect
12+
github.com/mitchellh/go-homedir v0.0.0-20160301183130-981ab348d865
13+
github.com/rakyll/goini v0.0.0-20140112234134-907cca0f578a
14+
github.com/sergi/go-diff v1.2.0 // indirect
15+
github.com/stretchr/testify v1.7.0 // indirect
16+
github.com/toqueteos/webbrowser v1.0.0
17+
gopkg.in/alecthomas/kingpin.v2 v2.1.11
18+
)

go.sum

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm+0dGI2AIUHY+w0BUc+4tn40djz7+6U=
2+
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI=
3+
github.com/alecthomas/colour v0.1.0 h1:nOE9rJm6dsZ66RGWYSFrXw461ZIt9A6+nHgL7FRrDUk=
4+
github.com/alecthomas/colour v0.1.0/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0=
5+
github.com/alecthomas/repr v0.0.0-20210301060118-828286944d6a h1:GY6ZI5mOHoiQ+g2ETFQGYu6fNgc6bCe4b4kr8tSrhpg=
6+
github.com/alecthomas/repr v0.0.0-20210301060118-828286944d6a/go.mod h1:2kn6fqh/zIyPLmm3ugklbEi5hg5wS435eygvNfaDQL8=
7+
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU=
8+
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
9+
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY=
10+
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
11+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
12+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
13+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
14+
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
15+
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
16+
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
17+
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
18+
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
19+
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
20+
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
21+
github.com/mitchellh/go-homedir v0.0.0-20160301183130-981ab348d865 h1:bCuq5mC5XKQognwAQG20DK+aKXCl9qbQr253imrLfMY=
22+
github.com/mitchellh/go-homedir v0.0.0-20160301183130-981ab348d865/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
23+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
24+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
25+
github.com/rakyll/goini v0.0.0-20140112234134-907cca0f578a h1:3JTBH+06LYYw3LjAsvp2mVXLDayQZxXmfm2zGlzOH1Y=
26+
github.com/rakyll/goini v0.0.0-20140112234134-907cca0f578a/go.mod h1:1pH5e1EQl4shdpnuDQPO1hEzmk/oXrZrnWENs1lZjCk=
27+
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
28+
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
29+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
30+
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
31+
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
32+
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
33+
github.com/toqueteos/webbrowser v1.0.0 h1:RuypZ2eTUNrYG5WKWj4eU1ZEbxDPOuImkSADGfdsdNE=
34+
github.com/toqueteos/webbrowser v1.0.0/go.mod h1:Hqqqmzj8AHn+VlZyVjaRWY20i25hoOZGAABCcg2el4A=
35+
golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg=
36+
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
37+
gopkg.in/alecthomas/kingpin.v2 v2.1.11 h1:XkypDUTQATD111Q6hJPVuyjVynaJV9DW27v01t91IbM=
38+
gopkg.in/alecthomas/kingpin.v2 v2.1.11/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
39+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
40+
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
41+
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
42+
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
43+
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
44+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
45+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

headers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ package main
22

33
import (
44
"fmt"
5-
"strings"
6-
"net/http"
75
"gopkg.in/alecthomas/kingpin.v2"
6+
"net/http"
7+
"strings"
88
)
99

1010
type HTTPHeaderValue http.Header

0 commit comments

Comments
 (0)