mirror of
https://github.com/thegeeklab/url-parser.git
synced 2024-09-27 17:58:16 +00:00
Compare commits
28 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
75a3f7dc4a | ||
|
7732914f1a | ||
|
776e809c52 | ||
|
4a02590ff2 | ||
|
8b66ceb9c4 | ||
9238878382 | |||
|
ae0cbaa654 | ||
|
9047fa86a4 | ||
|
441a10a33d | ||
|
3c053eef7d | ||
|
cf3d105310 | ||
|
70f0d4e5b3 | ||
9ff6cd2e6a | |||
|
d36d95846e | ||
|
5c8b9d9cd5 | ||
|
77d3c11da1 | ||
|
df1cb658f3 | ||
|
659ddcee44 | ||
7d4e9651f5 | |||
|
c6b5c9d03d | ||
|
656f744c52 | ||
b01ea54ae9 | |||
6c04899a49 | |||
|
edbced6e5b | ||
|
8f8506617a | ||
|
7cbec15ac2 | ||
5f80b2a7f3 | |||
8c4de70ec4 |
@ -23,7 +23,6 @@ linters:
|
|||||||
- errchkjson
|
- errchkjson
|
||||||
- errname
|
- errname
|
||||||
- errorlint
|
- errorlint
|
||||||
- execinquery
|
|
||||||
- exhaustive
|
- exhaustive
|
||||||
- exportloopref
|
- exportloopref
|
||||||
- forcetypeassert
|
- forcetypeassert
|
||||||
@ -37,12 +36,12 @@ linters:
|
|||||||
- gocyclo
|
- gocyclo
|
||||||
- godot
|
- godot
|
||||||
- godox
|
- godox
|
||||||
- goerr113
|
- err113
|
||||||
- gofmt
|
- gofmt
|
||||||
- gofumpt
|
- gofumpt
|
||||||
- goheader
|
- goheader
|
||||||
- goimports
|
- goimports
|
||||||
- gomnd
|
- mnd
|
||||||
- gomoddirectives
|
- gomoddirectives
|
||||||
- gomodguard
|
- gomodguard
|
||||||
- goprintffuncname
|
- goprintffuncname
|
||||||
|
@ -6,26 +6,25 @@ when:
|
|||||||
- ${CI_REPO_DEFAULT_BRANCH}
|
- ${CI_REPO_DEFAULT_BRANCH}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
build:
|
- name: build
|
||||||
image: docker.io/techknowlogick/xgo:go-1.21.x
|
image: docker.io/techknowlogick/xgo:go-1.22.x
|
||||||
commands:
|
commands:
|
||||||
- ln -s $(pwd) /source
|
- ln -s $(pwd) /source
|
||||||
- make release
|
- make release
|
||||||
|
|
||||||
executable:
|
- name: executable
|
||||||
image: quay.io/thegeeklab/alpine-tools
|
image: quay.io/thegeeklab/alpine-tools
|
||||||
commands:
|
commands:
|
||||||
- $(find dist/ -executable -type f -iname ${CI_REPO_NAME}-linux-amd64) --help
|
- $(find dist/ -executable -type f -iname ${CI_REPO_NAME}-linux-amd64) --help
|
||||||
|
|
||||||
changelog:
|
- name: changelog
|
||||||
image: quay.io/thegeeklab/git-sv
|
image: quay.io/thegeeklab/git-sv
|
||||||
commands:
|
commands:
|
||||||
- git fetch --depth=2147483647
|
|
||||||
- git sv current-version
|
- git sv current-version
|
||||||
- git sv release-notes -t ${CI_COMMIT_TAG:-next} -o CHANGELOG.md
|
- git sv release-notes -t ${CI_COMMIT_TAG:-next} -o CHANGELOG.md
|
||||||
- cat CHANGELOG.md
|
- cat CHANGELOG.md
|
||||||
|
|
||||||
publish-github:
|
- name: publish-github
|
||||||
image: docker.io/plugins/github-release
|
image: docker.io/plugins/github-release
|
||||||
settings:
|
settings:
|
||||||
api_key:
|
api_key:
|
||||||
|
@ -6,18 +6,17 @@ when:
|
|||||||
- ${CI_REPO_DEFAULT_BRANCH}
|
- ${CI_REPO_DEFAULT_BRANCH}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
markdownlint:
|
- name: markdownlint
|
||||||
image: quay.io/thegeeklab/markdownlint-cli
|
image: quay.io/thegeeklab/markdownlint-cli
|
||||||
commands:
|
commands:
|
||||||
- markdownlint 'README.md' 'CONTRIBUTING.md'
|
- markdownlint 'README.md' 'CONTRIBUTING.md'
|
||||||
|
|
||||||
spellcheck:
|
- name: spellcheck
|
||||||
image: quay.io/thegeeklab/alpine-tools
|
image: quay.io/thegeeklab/alpine-tools
|
||||||
commands:
|
commands:
|
||||||
- spellchecker --files 'README.md' 'CONTRIBUTING.md' -d .dictionary -p spell indefinite-article syntax-urls
|
- spellchecker --files 'README.md' 'CONTRIBUTING.md' -d .dictionary -p spell indefinite-article syntax-urls
|
||||||
environment:
|
environment:
|
||||||
FORCE_COLOR: "true"
|
FORCE_COLOR: "true"
|
||||||
NPM_CONFIG_LOGLEVEL: "error"
|
|
||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- build-package
|
- build-package
|
||||||
|
@ -8,17 +8,17 @@ when:
|
|||||||
runs_on: [success, failure]
|
runs_on: [success, failure]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
matrix:
|
- name: matrix
|
||||||
image: quay.io/thegeeklab/wp-matrix
|
image: quay.io/thegeeklab/wp-matrix
|
||||||
settings:
|
settings:
|
||||||
homeserver:
|
homeserver:
|
||||||
from_secret: matrix_homeserver
|
from_secret: matrix_homeserver
|
||||||
password:
|
room_id:
|
||||||
from_secret: matrix_password
|
from_secret: matrix_room_id
|
||||||
roomid:
|
user_id:
|
||||||
from_secret: matrix_roomid
|
from_secret: matrix_user_id
|
||||||
username:
|
access_token:
|
||||||
from_secret: matrix_username
|
from_secret: matrix_access_token
|
||||||
when:
|
when:
|
||||||
- status: [success, failure]
|
- status: [success, failure]
|
||||||
|
|
||||||
|
@ -6,12 +6,12 @@ when:
|
|||||||
- ${CI_REPO_DEFAULT_BRANCH}
|
- ${CI_REPO_DEFAULT_BRANCH}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
lint:
|
- name: lint
|
||||||
image: docker.io/library/golang:1.21
|
image: docker.io/library/golang:1.23
|
||||||
commands:
|
commands:
|
||||||
- make lint
|
- make lint
|
||||||
|
|
||||||
test:
|
- name: test
|
||||||
image: docker.io/library/golang:1.21
|
image: docker.io/library/golang:1.23
|
||||||
commands:
|
commands:
|
||||||
- make test
|
- make test
|
||||||
|
6
Makefile
6
Makefile
@ -1,7 +1,7 @@
|
|||||||
# renovate: datasource=github-releases depName=mvdan/gofumpt
|
# renovate: datasource=github-releases depName=mvdan/gofumpt
|
||||||
GOFUMPT_PACKAGE_VERSION := v0.5.0
|
GOFUMPT_PACKAGE_VERSION := v0.7.0
|
||||||
# renovate: datasource=github-releases depName=golangci/golangci-lint
|
# renovate: datasource=github-releases depName=golangci/golangci-lint
|
||||||
GOLANGCI_LINT_PACKAGE_VERSION := v1.55.2
|
GOLANGCI_LINT_PACKAGE_VERSION := v1.61.0
|
||||||
|
|
||||||
EXECUTABLE := url-parser
|
EXECUTABLE := url-parser
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
|
|||||||
GOTESTSUM_PACKAGE ?= gotest.tools/gotestsum@latest
|
GOTESTSUM_PACKAGE ?= gotest.tools/gotestsum@latest
|
||||||
|
|
||||||
GENERATE ?=
|
GENERATE ?=
|
||||||
XGO_VERSION := go-1.21.x
|
XGO_VERSION := go-1.22.x
|
||||||
XGO_TARGETS ?= linux/amd64,linux/arm-6,linux/arm-7,linux/arm64
|
XGO_TARGETS ?= linux/amd64,linux/arm-6,linux/arm-7,linux/arm64
|
||||||
|
|
||||||
TARGETOS ?= linux
|
TARGETOS ?= linux
|
||||||
|
@ -99,7 +99,7 @@ func main() {
|
|||||||
Action: command.Fragment(cfg),
|
Action: command.Fragment(cfg),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Before: func(ctx *cli.Context) error {
|
Before: func(_ *cli.Context) error {
|
||||||
if cfg.URL == "" {
|
if cfg.URL == "" {
|
||||||
stat, _ := os.Stdin.Stat()
|
stat, _ := os.Stdin.Stat()
|
||||||
if (stat.Mode() & os.ModeCharDevice) == 0 {
|
if (stat.Mode() & os.ModeCharDevice) == 0 {
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Fragment prints out the fragment part from the url.
|
// Fragment prints out the fragment part from the url.
|
||||||
func Fragment(cfg *config.Config) cli.ActionFunc {
|
func Fragment(cfg *config.Config) cli.ActionFunc {
|
||||||
return func(ctx *cli.Context) error {
|
return func(_ *cli.Context) error {
|
||||||
parts := parseURL(cfg.URL)
|
parts := parseURL(cfg.URL)
|
||||||
|
|
||||||
if len(parts.Scheme) > 0 {
|
if len(parts.Scheme) > 0 {
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Host prints out the host part from the url.
|
// Host prints out the host part from the url.
|
||||||
func Host(cfg *config.Config) cli.ActionFunc {
|
func Host(cfg *config.Config) cli.ActionFunc {
|
||||||
return func(ctx *cli.Context) error {
|
return func(_ *cli.Context) error {
|
||||||
parts := parseURL(cfg.URL)
|
parts := parseURL(cfg.URL)
|
||||||
|
|
||||||
if len(parts.Scheme) > 0 {
|
if len(parts.Scheme) > 0 {
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Password prints out the password part from url.
|
// Password prints out the password part from url.
|
||||||
func Password(cfg *config.Config) cli.ActionFunc {
|
func Password(cfg *config.Config) cli.ActionFunc {
|
||||||
return func(ctx *cli.Context) error {
|
return func(_ *cli.Context) error {
|
||||||
parts := parseURL(cfg.URL)
|
parts := parseURL(cfg.URL)
|
||||||
|
|
||||||
if parts.User != nil {
|
if parts.User != nil {
|
||||||
|
@ -23,7 +23,7 @@ func PathFlags(cfg *config.Config) []cli.Flag {
|
|||||||
|
|
||||||
// Path prints out the path part from url.
|
// Path prints out the path part from url.
|
||||||
func Path(cfg *config.Config) cli.ActionFunc {
|
func Path(cfg *config.Config) cli.ActionFunc {
|
||||||
return func(ctx *cli.Context) error {
|
return func(_ *cli.Context) error {
|
||||||
parts := parseURL(cfg.URL)
|
parts := parseURL(cfg.URL)
|
||||||
i := cfg.PathIndex
|
i := cfg.PathIndex
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Port prints out the port from the url.
|
// Port prints out the port from the url.
|
||||||
func Port(cfg *config.Config) cli.ActionFunc {
|
func Port(cfg *config.Config) cli.ActionFunc {
|
||||||
return func(ctx *cli.Context) error {
|
return func(_ *cli.Context) error {
|
||||||
parts := parseURL(cfg.URL)
|
parts := parseURL(cfg.URL)
|
||||||
|
|
||||||
if len(parts.Scheme) > 0 {
|
if len(parts.Scheme) > 0 {
|
||||||
|
@ -21,7 +21,7 @@ func QueryFlags(cfg *config.Config) []cli.Flag {
|
|||||||
|
|
||||||
// Query prints out the query part from url.
|
// Query prints out the query part from url.
|
||||||
func Query(cfg *config.Config) cli.ActionFunc {
|
func Query(cfg *config.Config) cli.ActionFunc {
|
||||||
return func(ctx *cli.Context) error {
|
return func(_ *cli.Context) error {
|
||||||
parts := parseURL(cfg.URL)
|
parts := parseURL(cfg.URL)
|
||||||
f := cfg.QueryField
|
f := cfg.QueryField
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Run default command and print out full url.
|
// Run default command and print out full url.
|
||||||
func Run(cfg *config.Config) cli.ActionFunc {
|
func Run(cfg *config.Config) cli.ActionFunc {
|
||||||
return func(ctx *cli.Context) error {
|
return func(_ *cli.Context) error {
|
||||||
parts := parseURL(cfg.URL)
|
parts := parseURL(cfg.URL)
|
||||||
|
|
||||||
if len(parts.String()) > 0 {
|
if len(parts.String()) > 0 {
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Scheme prints out the scheme part from the url.
|
// Scheme prints out the scheme part from the url.
|
||||||
func Scheme(cfg *config.Config) cli.ActionFunc {
|
func Scheme(cfg *config.Config) cli.ActionFunc {
|
||||||
return func(ctx *cli.Context) error {
|
return func(_ *cli.Context) error {
|
||||||
parts := parseURL(cfg.URL)
|
parts := parseURL(cfg.URL)
|
||||||
|
|
||||||
if len(parts.Scheme) > 0 {
|
if len(parts.Scheme) > 0 {
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// User prints out the user part from url.
|
// User prints out the user part from url.
|
||||||
func User(cfg *config.Config) cli.ActionFunc {
|
func User(cfg *config.Config) cli.ActionFunc {
|
||||||
return func(ctx *cli.Context) error {
|
return func(_ *cli.Context) error {
|
||||||
parts := parseURL(cfg.URL)
|
parts := parseURL(cfg.URL)
|
||||||
|
|
||||||
if parts.User != nil {
|
if parts.User != nil {
|
||||||
|
10
go.mod
10
go.mod
@ -1,18 +1,18 @@
|
|||||||
module github.com/thegeeklab/url-parser
|
module github.com/thegeeklab/url-parser
|
||||||
|
|
||||||
go 1.21
|
go 1.22
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/rs/zerolog v1.31.0
|
github.com/rs/zerolog v1.33.0
|
||||||
github.com/urfave/cli/v2 v2.26.0
|
github.com/urfave/cli/v2 v2.27.4
|
||||||
github.com/zenizh/go-capturer v0.0.0-20211219060012-52ea6c8fed04
|
github.com/zenizh/go-capturer v0.0.0-20211219060012-52ea6c8fed04
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
|
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.19 // indirect
|
github.com/mattn/go-isatty v0.0.19 // indirect
|
||||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
|
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
|
||||||
golang.org/x/sys v0.12.0 // indirect
|
golang.org/x/sys v0.12.0 // indirect
|
||||||
)
|
)
|
||||||
|
16
go.sum
16
go.sum
@ -1,6 +1,6 @@
|
|||||||
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
|
github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||||
@ -9,14 +9,14 @@ github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APP
|
|||||||
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
||||||
github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A=
|
github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
|
||||||
github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
|
github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
|
||||||
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
||||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/urfave/cli/v2 v2.26.0 h1:3f3AMg3HpThFNT4I++TKOejZO8yU55t3JnnSr4S4QEI=
|
github.com/urfave/cli/v2 v2.27.4 h1:o1owoI+02Eb+K107p27wEX9Bb8eqIoZCfLXloLUSWJ8=
|
||||||
github.com/urfave/cli/v2 v2.26.0/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ=
|
github.com/urfave/cli/v2 v2.27.4/go.mod h1:m4QzxcD2qpra4z7WhzEGn74WZLViBnMpb1ToCAKdGRQ=
|
||||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
|
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4=
|
||||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
|
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
|
||||||
github.com/zenizh/go-capturer v0.0.0-20211219060012-52ea6c8fed04 h1:qXafrlZL1WsJW5OokjraLLRURHiw0OzKHD/RNdspp4w=
|
github.com/zenizh/go-capturer v0.0.0-20211219060012-52ea6c8fed04 h1:qXafrlZL1WsJW5OokjraLLRURHiw0OzKHD/RNdspp4w=
|
||||||
github.com/zenizh/go-capturer v0.0.0-20211219060012-52ea6c8fed04/go.mod h1:FiwNQxz6hGoNFBC4nIx+CxZhI3nne5RmIOlT/MXcSD4=
|
github.com/zenizh/go-capturer v0.0.0-20211219060012-52ea6c8fed04/go.mod h1:FiwNQxz6hGoNFBC4nIx+CxZhI3nne5RmIOlT/MXcSD4=
|
||||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
Loading…
Reference in New Issue
Block a user