Compare commits

..

No commits in common. "main" and "v2.0.1" have entirely different histories.
main ... v2.0.1

18 changed files with 44 additions and 41 deletions

View File

@ -23,6 +23,7 @@ linters:
- errchkjson
- errname
- errorlint
- execinquery
- exhaustive
- exportloopref
- forcetypeassert
@ -36,12 +37,12 @@ linters:
- gocyclo
- godot
- godox
- err113
- goerr113
- gofmt
- gofumpt
- goheader
- goimports
- mnd
- gomnd
- gomoddirectives
- gomodguard
- goprintffuncname

View File

@ -6,25 +6,26 @@ when:
- ${CI_REPO_DEFAULT_BRANCH}
steps:
- name: build
image: docker.io/techknowlogick/xgo:go-1.22.x
build:
image: docker.io/techknowlogick/xgo:go-1.21.x
commands:
- ln -s $(pwd) /source
- make release
- name: executable
executable:
image: quay.io/thegeeklab/alpine-tools
commands:
- $(find dist/ -executable -type f -iname ${CI_REPO_NAME}-linux-amd64) --help
- name: changelog
changelog:
image: quay.io/thegeeklab/git-sv
commands:
- git fetch --depth=2147483647
- git sv current-version
- git sv release-notes -t ${CI_COMMIT_TAG:-next} -o CHANGELOG.md
- cat CHANGELOG.md
- name: publish-github
publish-github:
image: docker.io/plugins/github-release
settings:
api_key:
@ -35,7 +36,7 @@ steps:
overwrite: true
title: ${CI_COMMIT_TAG}
when:
- event: [tag]
- event: [tag]
depends_on:
- test

View File

@ -6,17 +6,18 @@ when:
- ${CI_REPO_DEFAULT_BRANCH}
steps:
- name: markdownlint
markdownlint:
image: quay.io/thegeeklab/markdownlint-cli
commands:
- markdownlint 'README.md' 'CONTRIBUTING.md'
- name: spellcheck
spellcheck:
image: quay.io/thegeeklab/alpine-tools
commands:
- spellchecker --files 'README.md' 'CONTRIBUTING.md' -d .dictionary -p spell indefinite-article syntax-urls
environment:
FORCE_COLOR: "true"
NPM_CONFIG_LOGLEVEL: "error"
depends_on:
- build-package

View File

@ -8,7 +8,7 @@ when:
runs_on: [success, failure]
steps:
- name: matrix
matrix:
image: quay.io/thegeeklab/wp-matrix
settings:
homeserver:

View File

@ -6,12 +6,12 @@ when:
- ${CI_REPO_DEFAULT_BRANCH}
steps:
- name: lint
image: docker.io/library/golang:1.22
lint:
image: docker.io/library/golang:1.21
commands:
- make lint
- name: test
image: docker.io/library/golang:1.22
test:
image: docker.io/library/golang:1.21
commands:
- make test

View File

@ -1,7 +1,7 @@
# renovate: datasource=github-releases depName=mvdan/gofumpt
GOFUMPT_PACKAGE_VERSION := v0.6.0
GOFUMPT_PACKAGE_VERSION := v0.5.0
# renovate: datasource=github-releases depName=golangci/golangci-lint
GOLANGCI_LINT_PACKAGE_VERSION := v1.59.1
GOLANGCI_LINT_PACKAGE_VERSION := v1.55.2
EXECUTABLE := url-parser
@ -20,7 +20,7 @@ XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
GOTESTSUM_PACKAGE ?= gotest.tools/gotestsum@latest
GENERATE ?=
XGO_VERSION := go-1.22.x
XGO_VERSION := go-1.21.x
XGO_TARGETS ?= linux/amd64,linux/arm-6,linux/arm-7,linux/arm64
TARGETOS ?= linux

View File

@ -99,7 +99,7 @@ func main() {
Action: command.Fragment(cfg),
},
},
Before: func(_ *cli.Context) error {
Before: func(ctx *cli.Context) error {
if cfg.URL == "" {
stat, _ := os.Stdin.Stat()
if (stat.Mode() & os.ModeCharDevice) == 0 {

View File

@ -9,7 +9,7 @@ import (
// Fragment prints out the fragment part from the url.
func Fragment(cfg *config.Config) cli.ActionFunc {
return func(_ *cli.Context) error {
return func(ctx *cli.Context) error {
parts := parseURL(cfg.URL)
if len(parts.Scheme) > 0 {

View File

@ -9,7 +9,7 @@ import (
// Host prints out the host part from the url.
func Host(cfg *config.Config) cli.ActionFunc {
return func(_ *cli.Context) error {
return func(ctx *cli.Context) error {
parts := parseURL(cfg.URL)
if len(parts.Scheme) > 0 {

View File

@ -9,7 +9,7 @@ import (
// Password prints out the password part from url.
func Password(cfg *config.Config) cli.ActionFunc {
return func(_ *cli.Context) error {
return func(ctx *cli.Context) error {
parts := parseURL(cfg.URL)
if parts.User != nil {

View File

@ -23,7 +23,7 @@ func PathFlags(cfg *config.Config) []cli.Flag {
// Path prints out the path part from url.
func Path(cfg *config.Config) cli.ActionFunc {
return func(_ *cli.Context) error {
return func(ctx *cli.Context) error {
parts := parseURL(cfg.URL)
i := cfg.PathIndex

View File

@ -9,7 +9,7 @@ import (
// Port prints out the port from the url.
func Port(cfg *config.Config) cli.ActionFunc {
return func(_ *cli.Context) error {
return func(ctx *cli.Context) error {
parts := parseURL(cfg.URL)
if len(parts.Scheme) > 0 {

View File

@ -21,7 +21,7 @@ func QueryFlags(cfg *config.Config) []cli.Flag {
// Query prints out the query part from url.
func Query(cfg *config.Config) cli.ActionFunc {
return func(_ *cli.Context) error {
return func(ctx *cli.Context) error {
parts := parseURL(cfg.URL)
f := cfg.QueryField

View File

@ -9,7 +9,7 @@ import (
// Run default command and print out full url.
func Run(cfg *config.Config) cli.ActionFunc {
return func(_ *cli.Context) error {
return func(ctx *cli.Context) error {
parts := parseURL(cfg.URL)
if len(parts.String()) > 0 {

View File

@ -9,7 +9,7 @@ import (
// Scheme prints out the scheme part from the url.
func Scheme(cfg *config.Config) cli.ActionFunc {
return func(_ *cli.Context) error {
return func(ctx *cli.Context) error {
parts := parseURL(cfg.URL)
if len(parts.Scheme) > 0 {

View File

@ -9,7 +9,7 @@ import (
// User prints out the user part from url.
func User(cfg *config.Config) cli.ActionFunc {
return func(_ *cli.Context) error {
return func(ctx *cli.Context) error {
parts := parseURL(cfg.URL)
if parts.User != nil {

10
go.mod
View File

@ -1,18 +1,18 @@
module github.com/thegeeklab/url-parser
go 1.22
go 1.21
require (
github.com/rs/zerolog v1.33.0
github.com/urfave/cli/v2 v2.27.2
github.com/rs/zerolog v1.31.0
github.com/urfave/cli/v2 v2.26.0
github.com/zenizh/go-capturer v0.0.0-20211219060012-52ea6c8fed04
)
require (
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
golang.org/x/sys v0.12.0 // indirect
)

16
go.sum
View File

@ -1,6 +1,6 @@
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
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/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/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A=
github.com/rs/zerolog v1.31.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/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/urfave/cli/v2 v2.27.2 h1:6e0H+AkS+zDckwPCUrZkKX38mRaau4nL2uipkJpbkcI=
github.com/urfave/cli/v2 v2.27.2/go.mod h1:g0+79LmHHATl7DAcHO99smiR/T7uGLw84w8Y42x+4eM=
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 h1:+qGGcbkzsfDQNPPe9UDgpxAWQrhbbBXOYJFQDq/dtJw=
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913/go.mod h1:4aEEwZQutDLsQv2Deui4iYQ6DWTxR14g6m8Wv88+Xqk=
github.com/urfave/cli/v2 v2.26.0 h1:3f3AMg3HpThFNT4I++TKOejZO8yU55t3JnnSr4S4QEI=
github.com/urfave/cli/v2 v2.26.0/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
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=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=