mirror of
https://github.com/thegeeklab/url-parser.git
synced 2024-11-24 22:20:40 +00:00
refactoring
This commit is contained in:
parent
c6d5f7f290
commit
ac2276d118
190
.drone.jsonnet
Normal file
190
.drone.jsonnet
Normal file
@ -0,0 +1,190 @@
|
||||
local PipelineTest = {
|
||||
kind: 'pipeline',
|
||||
name: 'test',
|
||||
platform: {
|
||||
os: 'linux',
|
||||
arch: 'amd64',
|
||||
},
|
||||
steps: [
|
||||
{
|
||||
name: 'staticcheck',
|
||||
image: 'golang:1.14',
|
||||
commands: [
|
||||
'go run honnef.co/go/tools/cmd/staticcheck ./...',
|
||||
],
|
||||
volumes: [
|
||||
{
|
||||
name: 'gopath',
|
||||
path: '/go',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'lint',
|
||||
image: 'golang:1.14',
|
||||
commands: [
|
||||
'go run golang.org/x/lint/golint -set_exit_status ./...',
|
||||
],
|
||||
volumes: [
|
||||
{
|
||||
name: 'gopath',
|
||||
path: '/go',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'vet',
|
||||
image: 'golang:1.14',
|
||||
commands: [
|
||||
'go vet ./...',
|
||||
],
|
||||
volumes: [
|
||||
{
|
||||
name: 'gopath',
|
||||
path: '/go',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'test',
|
||||
image: 'golang:1.14',
|
||||
commands: [
|
||||
'go test -race -coverprofile=coverage.txt -covermode=atomic ./...',
|
||||
],
|
||||
volumes: [
|
||||
{
|
||||
name: 'gopath',
|
||||
path: '/go',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'coverage',
|
||||
image: 'plugins/codecov',
|
||||
settings: {
|
||||
token: {
|
||||
from_secret: 'codecov_token',
|
||||
},
|
||||
files: [
|
||||
'coverage.txt',
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
volumes: [
|
||||
{
|
||||
name: 'gopath',
|
||||
temp: {},
|
||||
},
|
||||
],
|
||||
trigger: {
|
||||
ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'],
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
local PipelineBuildBinaries = {
|
||||
kind: 'pipeline',
|
||||
name: 'build-binaries',
|
||||
platform: {
|
||||
os: 'linux',
|
||||
arch: 'amd64',
|
||||
},
|
||||
steps: [
|
||||
{
|
||||
name: 'build',
|
||||
image: 'techknowlogick/xgo:go-1.14.x',
|
||||
commands: [
|
||||
'[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}',
|
||||
'mkdir -p release/',
|
||||
"cd cmd/github-releases-notifier && xgo -ldflags \"-s -w -X main.version=$BUILD_VERSION\" -tags netgo -targets 'linux/amd64,linux/arm-6,linux/arm64' -out github-releases-notifier .",
|
||||
'mv /build/* /drone/src/release/',
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'executable',
|
||||
image: 'alpine',
|
||||
commands: [
|
||||
'$(find release/ -executable -type f | grep github-releases-notifier-linux-amd64) --help',
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'compress',
|
||||
image: 'alpine',
|
||||
commands: [
|
||||
'apk add upx',
|
||||
'find release/ -maxdepth 1 -executable -type f -exec upx {} \\;',
|
||||
'ls -lh release/',
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'checksum',
|
||||
image: 'alpine',
|
||||
commands: [
|
||||
'cd release/ && sha256sum * > sha256sum.txt',
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'publish',
|
||||
image: 'plugins/github-release',
|
||||
settings: {
|
||||
overwrite: true,
|
||||
api_key: {
|
||||
from_secret: 'github_token',
|
||||
},
|
||||
files: ['release/*'],
|
||||
title: '${DRONE_TAG}',
|
||||
note: 'CHANGELOG.md',
|
||||
},
|
||||
when: {
|
||||
ref: [
|
||||
'refs/tags/**',
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
depends_on: [
|
||||
'test',
|
||||
],
|
||||
trigger: {
|
||||
ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'],
|
||||
},
|
||||
};
|
||||
|
||||
local PipelineNotifications = {
|
||||
kind: 'pipeline',
|
||||
name: 'notifications',
|
||||
platform: {
|
||||
os: 'linux',
|
||||
arch: 'amd64',
|
||||
},
|
||||
steps: [
|
||||
{
|
||||
name: 'matrix',
|
||||
image: 'plugins/matrix',
|
||||
settings: {
|
||||
homeserver: { from_secret: 'matrix_homeserver' },
|
||||
roomid: { from_secret: 'matrix_roomid' },
|
||||
template: 'Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}',
|
||||
username: { from_secret: 'matrix_username' },
|
||||
password: { from_secret: 'matrix_password' },
|
||||
},
|
||||
when: {
|
||||
status: ['success', 'failure'],
|
||||
},
|
||||
},
|
||||
],
|
||||
depends_on: [
|
||||
'build-binaries',
|
||||
],
|
||||
trigger: {
|
||||
ref: ['refs/heads/master', 'refs/tags/**'],
|
||||
status: ['success', 'failure'],
|
||||
},
|
||||
};
|
||||
|
||||
[
|
||||
PipelineTest,
|
||||
PipelineBuildBinaries,
|
||||
PipelineNotifications,
|
||||
]
|
171
.drone.star
171
.drone.star
@ -1,171 +0,0 @@
|
||||
def main(ctx):
|
||||
before = testing()
|
||||
|
||||
stages = [
|
||||
binaries([]),
|
||||
]
|
||||
|
||||
after = notification()
|
||||
|
||||
for b in before:
|
||||
for s in stages:
|
||||
s['depends_on'].append(b['name'])
|
||||
|
||||
for s in stages:
|
||||
for a in after:
|
||||
a['depends_on'].append(s['name'])
|
||||
|
||||
return before + stages + after
|
||||
|
||||
def testing():
|
||||
return [{
|
||||
'kind': 'pipeline',
|
||||
'type': 'docker',
|
||||
'name': 'testing',
|
||||
'platform': {
|
||||
'os': 'linux',
|
||||
'arch': 'amd64',
|
||||
},
|
||||
'steps': [
|
||||
{
|
||||
'name': 'vet',
|
||||
'image': 'golang:1.12',
|
||||
'commands': [
|
||||
'go vet ./...'
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'test',
|
||||
'image': 'golang:1.12',
|
||||
'commands': [
|
||||
'go test -race -coverprofile=coverage.txt -covermode=atomic ./...'
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'coverage',
|
||||
'image': 'plugins/codecov',
|
||||
'settings': {
|
||||
'token': {
|
||||
'from_secret': 'codecov_token',
|
||||
},
|
||||
'files':[
|
||||
'coverage.txt'
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
'trigger': {
|
||||
'ref': [
|
||||
'refs/heads/master',
|
||||
'refs/tags/**',
|
||||
'refs/pull/**'
|
||||
]
|
||||
}
|
||||
}]
|
||||
|
||||
def binaries(arch):
|
||||
return {
|
||||
'kind': 'pipeline',
|
||||
'type': 'docker',
|
||||
'name': 'build-binaries',
|
||||
'steps': [
|
||||
{
|
||||
'name': 'build',
|
||||
'image': 'techknowlogick/xgo:latest',
|
||||
'commands': [
|
||||
'[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}',
|
||||
'mkdir -p release/',
|
||||
"cd cmd/url-parser && xgo -ldflags \"-s -w -X main.Version=$BUILD_VERSION\" -tags netgo -targets 'linux/amd64,linux/arm-6,linux/arm64' -out url-parser-$BUILD_VERSION .",
|
||||
'cp /build/* /drone/src/release/'
|
||||
]
|
||||
},
|
||||
{
|
||||
'name': 'executable',
|
||||
'image': 'alpine',
|
||||
'commands': [
|
||||
'$(find release/ -executable -type f | grep url-parser-.*-linux-amd64) --help',
|
||||
]
|
||||
},
|
||||
{
|
||||
'name': 'compress',
|
||||
'image': 'alpine',
|
||||
'commands': [
|
||||
'apk add upx',
|
||||
'find release/ -maxdepth 1 -executable -type f -exec upx {} \;',
|
||||
'ls -lh release/',
|
||||
]
|
||||
},
|
||||
{
|
||||
'name': 'checksum',
|
||||
'image': 'alpine',
|
||||
'commands': [
|
||||
'cd release/ && sha256sum * > sha256sum.txt',
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'publish',
|
||||
'image': 'plugins/github-release',
|
||||
'settings': {
|
||||
'overwrite': True,
|
||||
'api_key': {
|
||||
'from_secret': 'github_token'
|
||||
},
|
||||
'files': [ "release/*" ],
|
||||
'title': '${DRONE_TAG}',
|
||||
'note': 'CHANGELOG.md',
|
||||
},
|
||||
'when': {
|
||||
'ref': [
|
||||
'refs/tags/**'
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
'depends_on': [],
|
||||
'trigger': {
|
||||
'ref': [
|
||||
'refs/heads/master',
|
||||
'refs/tags/**',
|
||||
'refs/pull/**'
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
def notification():
|
||||
return [{
|
||||
'kind': 'pipeline',
|
||||
'type': 'docker',
|
||||
'name': 'notification',
|
||||
'steps': [
|
||||
{
|
||||
'name': 'matrix',
|
||||
'image': 'plugins/matrix',
|
||||
'settings': {
|
||||
'homeserver': {
|
||||
'from_secret': 'matrix_homeserver',
|
||||
},
|
||||
'password': {
|
||||
'from_secret': 'matrix_password',
|
||||
},
|
||||
'roomid': {
|
||||
'from_secret': 'matrix_roomid',
|
||||
},
|
||||
'template': 'Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}',
|
||||
'username': {
|
||||
'from_secret': 'matrix_username',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
'depends_on': [],
|
||||
'trigger': {
|
||||
'ref': [
|
||||
'refs/heads/master',
|
||||
'refs/tags/**',
|
||||
],
|
||||
'status': [
|
||||
'success',
|
||||
'failure'
|
||||
]
|
||||
}
|
||||
}]
|
53
.drone.yml
53
.drone.yml
@ -1,22 +1,43 @@
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: testing
|
||||
name: test
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: staticcheck
|
||||
image: golang:1.14
|
||||
commands:
|
||||
- go run honnef.co/go/tools/cmd/staticcheck ./...
|
||||
volumes:
|
||||
- name: gopath
|
||||
path: /go
|
||||
|
||||
- name: lint
|
||||
image: golang:1.14
|
||||
commands:
|
||||
- go run golang.org/x/lint/golint -set_exit_status ./...
|
||||
volumes:
|
||||
- name: gopath
|
||||
path: /go
|
||||
|
||||
- name: vet
|
||||
image: golang:1.12
|
||||
image: golang:1.14
|
||||
commands:
|
||||
- go vet ./...
|
||||
volumes:
|
||||
- name: gopath
|
||||
path: /go
|
||||
|
||||
- name: test
|
||||
image: golang:1.12
|
||||
image: golang:1.14
|
||||
commands:
|
||||
- go test -race -coverprofile=coverage.txt -covermode=atomic ./...
|
||||
volumes:
|
||||
- name: gopath
|
||||
path: /go
|
||||
|
||||
- name: coverage
|
||||
image: plugins/codecov
|
||||
@ -26,6 +47,10 @@ steps:
|
||||
token:
|
||||
from_secret: codecov_token
|
||||
|
||||
volumes:
|
||||
- name: gopath
|
||||
temp: {}
|
||||
|
||||
trigger:
|
||||
ref:
|
||||
- refs/heads/master
|
||||
@ -34,7 +59,6 @@ trigger:
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: build-binaries
|
||||
|
||||
platform:
|
||||
@ -43,17 +67,17 @@ platform:
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: techknowlogick/xgo:latest
|
||||
image: techknowlogick/xgo:go-1.14.x
|
||||
commands:
|
||||
- "[ -z \"${DRONE_TAG}\" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}"
|
||||
- mkdir -p release/
|
||||
- cd cmd/url-parser && xgo -ldflags "-s -w -X main.Version=$BUILD_VERSION" -tags netgo -targets 'linux/amd64,linux/arm-6,linux/arm64' -out url-parser-$BUILD_VERSION .
|
||||
- cp /build/* /drone/src/release/
|
||||
- cd cmd/github-releases-notifier && xgo -ldflags "-s -w -X main.version=$BUILD_VERSION" -tags netgo -targets 'linux/amd64,linux/arm-6,linux/arm64' -out github-releases-notifier .
|
||||
- mv /build/* /drone/src/release/
|
||||
|
||||
- name: executable
|
||||
image: alpine
|
||||
commands:
|
||||
- $(find release/ -executable -type f | grep url-parser-.*-linux-amd64) --help
|
||||
- $(find release/ -executable -type f | grep github-releases-notifier-linux-amd64) --help
|
||||
|
||||
- name: compress
|
||||
image: alpine
|
||||
@ -88,12 +112,11 @@ trigger:
|
||||
- refs/pull/**
|
||||
|
||||
depends_on:
|
||||
- testing
|
||||
- test
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: notification
|
||||
name: notifications
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
@ -112,6 +135,10 @@ steps:
|
||||
template: "Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}"
|
||||
username:
|
||||
from_secret: matrix_username
|
||||
when:
|
||||
status:
|
||||
- success
|
||||
- failure
|
||||
|
||||
trigger:
|
||||
ref:
|
||||
@ -126,6 +153,6 @@ depends_on:
|
||||
|
||||
---
|
||||
kind: signature
|
||||
hmac: 999c45dd679c809e8dc40c3f72d4e6a3f95c5f57f14ca2aba3472b7226893d13
|
||||
hmac: 5ca11cf4dc76a28155711c9665abeab4a3e61a5bd8c819588a76ba8baef16cfe
|
||||
|
||||
...
|
||||
|
55
.github/settings.yml
vendored
Normal file
55
.github/settings.yml
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
repository:
|
||||
name: url-parser
|
||||
description: Simple command-line URL parser
|
||||
topics: cli, tools, url, parser
|
||||
|
||||
private: false
|
||||
has_issues: true
|
||||
has_wiki: false
|
||||
has_downloads: true
|
||||
|
||||
default_branch: master
|
||||
|
||||
allow_squash_merge: true
|
||||
allow_merge_commit: true
|
||||
allow_rebase_merge: true
|
||||
|
||||
labels:
|
||||
- name: bug
|
||||
color: d73a4a
|
||||
description: Something isn't working
|
||||
- name: documentation
|
||||
color: 0075ca
|
||||
description: Improvements or additions to documentation
|
||||
- name: duplicate
|
||||
color: cfd3d7
|
||||
description: This issue or pull request already exists
|
||||
- name: enhancement
|
||||
color: a2eeef
|
||||
description: New feature or request
|
||||
- name: good first issue
|
||||
color: 7057ff
|
||||
description: Good for newcomers
|
||||
- name: help wanted
|
||||
color: 008672
|
||||
description: Extra attention is needed
|
||||
- name: invalid
|
||||
color: e4e669
|
||||
description: This doesn't seem right
|
||||
- name: question
|
||||
color: d876e3
|
||||
description: Further information is requested
|
||||
- name: wontfix
|
||||
color: ffffff
|
||||
description: This will not be worked on
|
||||
|
||||
branches:
|
||||
- name: master
|
||||
protection:
|
||||
required_pull_request_reviews: null
|
||||
required_status_checks:
|
||||
strict: true
|
||||
contexts:
|
||||
- continuous-integration/drone/pr
|
||||
enforce_admins: null
|
||||
restrictions: null
|
19
.gitignore
vendored
19
.gitignore
vendored
@ -1,17 +1,4 @@
|
||||
# Binaries for programs and plugins
|
||||
*.exe
|
||||
*.exe~
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
/release/
|
||||
/url-parser*
|
||||
|
||||
# Test binary, built with `go test -c`
|
||||
*.test
|
||||
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
*.out
|
||||
|
||||
# Dependency directories (remove the comment below to include it)
|
||||
# vendor/
|
||||
/url-parser
|
||||
coverage.txt
|
||||
coverage.out
|
||||
|
@ -1,2 +1,2 @@
|
||||
* FEATURE
|
||||
* Initial release
|
||||
- INTERNAL
|
||||
- refactor project structure
|
||||
|
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 Robert Kaussow <mail@geeklabor.de>
|
||||
Copyright (c) 2020 Robert Kaussow <mail@thegeeklab.de>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
17
README.md
17
README.md
@ -1,9 +1,14 @@
|
||||
# url-parser
|
||||
|
||||
[![Build Status](https://img.shields.io/drone/build/xoxys/url-parser?logo=drone)](https://cloud.drone.io/xoxys/url-parser)
|
||||
Simple command-line URL parser
|
||||
|
||||
[![Build Status](https://img.shields.io/drone/build/thegeeklab/url-parser?logo=drone)](https://cloud.drone.io/thegeeklab/url-parser)
|
||||
[![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/url-parser)
|
||||
[![Quay.io](https://img.shields.io/badge/quay-latest-blue.svg?logo=docker&logoColor=white)](https://quay.io/repository/thegeeklab/url-parser)
|
||||
[![Go Report Card](https://goreportcard.com/badge/github.com/thegeeklab/url-parser)](https://goreportcard.com/report/github.com/thegeeklab/url-parser)
|
||||
[![Codecov](https://img.shields.io/codecov/c/github/xoxys/url-parser)](https://codecov.io/gh/xoxys/url-parser)
|
||||
[![Go Report Card](https://goreportcard.com/badge/github.com/xoxys/url-parser)](https://goreportcard.com/report/github.com/xoxys/url-parser)
|
||||
[![License: MIT](https://img.shields.io/github/license/xoxys/url-parser)](LICENSE)
|
||||
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/url-parser)
|
||||
[![License: MIT](https://img.shields.io/github/license/thegeeklab/url-parser)](<[LICENSE](https://github.com/thegeeklab/url-parser/blob/master/LICENSE)>)
|
||||
|
||||
Inspired by [herloct/url-parser](https://github.com/herloct/url-parser), a simple command-line utility for parsing URLs.
|
||||
|
||||
@ -12,7 +17,7 @@ Inspired by [herloct/url-parser](https://github.com/herloct/url-parser), a simpl
|
||||
Prebuild multiarch binaries are availabe for Linux only:
|
||||
|
||||
```Shell
|
||||
curl -L https://github.com/xoxys/url-parser/releases/download/v0.1.0/url-parser-0.1.0-linux-amd64 > /usr/local/bin/url-parser
|
||||
curl -L https://github.com/thegeeklab/url-parser/releases/download/v0.1.0/url-parser-0.1.0-linux-amd64 > /usr/local/bin/url-parser
|
||||
chmod +x /usr/local/bin/url-parser
|
||||
url-parser --help
|
||||
```
|
||||
@ -73,7 +78,3 @@ somevalue
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
||||
|
||||
## Maintainers and Contributors
|
||||
|
||||
[Robert Kaussow](https://github.com/xoxys)
|
||||
|
@ -1,8 +1,8 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/thegeeklab/url-parser/internal/command"
|
||||
"github.com/urfave/cli/v2"
|
||||
"github.com/xoxys/url-parser/commands"
|
||||
)
|
||||
|
||||
func globalFlags() []cli.Flag {
|
||||
@ -21,63 +21,63 @@ func configCommands() []*cli.Command {
|
||||
Name: "all",
|
||||
Aliases: []string{"a"},
|
||||
Usage: "Get all parts from url",
|
||||
Action: commands.Run,
|
||||
Action: command.Run,
|
||||
Flags: globalFlags(),
|
||||
},
|
||||
{
|
||||
Name: "scheme",
|
||||
Aliases: []string{"s"},
|
||||
Usage: "Get scheme from url",
|
||||
Action: commands.Scheme,
|
||||
Action: command.Scheme,
|
||||
Flags: globalFlags(),
|
||||
},
|
||||
{
|
||||
Name: "user",
|
||||
Aliases: []string{"u"},
|
||||
Usage: "Get username from url",
|
||||
Action: commands.User,
|
||||
Action: command.User,
|
||||
Flags: globalFlags(),
|
||||
},
|
||||
{
|
||||
Name: "password",
|
||||
Aliases: []string{"pw"},
|
||||
Usage: "Get password from url",
|
||||
Action: commands.Password,
|
||||
Action: command.Password,
|
||||
Flags: globalFlags(),
|
||||
},
|
||||
{
|
||||
Name: "path",
|
||||
Aliases: []string{"pt"},
|
||||
Usage: "Get path from url",
|
||||
Action: commands.Path,
|
||||
Flags: append(globalFlags(), commands.PathFlags()...),
|
||||
Action: command.Path,
|
||||
Flags: append(globalFlags(), command.PathFlags()...),
|
||||
},
|
||||
{
|
||||
Name: "host",
|
||||
Aliases: []string{"h"},
|
||||
Usage: "Get hostname from url",
|
||||
Action: commands.Host,
|
||||
Action: command.Host,
|
||||
Flags: globalFlags(),
|
||||
},
|
||||
{
|
||||
Name: "port",
|
||||
Aliases: []string{"p"},
|
||||
Usage: "Get port from url",
|
||||
Action: commands.Port,
|
||||
Action: command.Port,
|
||||
Flags: globalFlags(),
|
||||
},
|
||||
{
|
||||
Name: "query",
|
||||
Aliases: []string{"q"},
|
||||
Usage: "Get query from url",
|
||||
Action: commands.Query,
|
||||
Flags: append(globalFlags(), commands.QueryFlags()...),
|
||||
Action: command.Query,
|
||||
Flags: append(globalFlags(), command.QueryFlags()...),
|
||||
},
|
||||
{
|
||||
Name: "fragment",
|
||||
Aliases: []string{"f"},
|
||||
Usage: "Get fragment from url",
|
||||
Action: commands.Fragment,
|
||||
Action: command.Fragment,
|
||||
Flags: globalFlags(),
|
||||
},
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/thegeeklab/url-parser/internal/command"
|
||||
"github.com/urfave/cli/v2"
|
||||
"github.com/xoxys/url-parser/commands"
|
||||
)
|
||||
|
||||
// Version of current build
|
||||
@ -16,7 +16,7 @@ func main() {
|
||||
app.Name = "url-parser"
|
||||
app.Usage = "Parse URL and shows the part of it."
|
||||
app.Version = Version
|
||||
app.Action = commands.Run
|
||||
app.Action = command.Run
|
||||
app.Flags = globalFlags()
|
||||
app.Commands = configCommands()
|
||||
|
||||
|
9
go.mod
9
go.mod
@ -1,10 +1,11 @@
|
||||
module github.com/xoxys/url-parser
|
||||
module github.com/thegeeklab/url-parser
|
||||
|
||||
go 1.13
|
||||
|
||||
require (
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
|
||||
github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d
|
||||
github.com/sirupsen/logrus v1.4.2
|
||||
github.com/urfave/cli v1.22.2
|
||||
github.com/urfave/cli/v2 v2.1.1
|
||||
github.com/sirupsen/logrus v1.6.0
|
||||
github.com/urfave/cli/v2 v2.2.0
|
||||
golang.org/x/sys v0.0.0-20200918174421-af09f7315aff // indirect
|
||||
)
|
||||
|
18
go.sum
18
go.sum
@ -1,27 +1,29 @@
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d h1:cVtBfNW5XTHiKQe7jDaDBSh/EVM4XLPutLAGboIXuM0=
|
||||
github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d/go.mod h1:P2viExyCEfeWGU259JnaQ34Inuec4R38JCyBx2edgD0=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
|
||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
|
||||
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
|
||||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/urfave/cli v1.22.2 h1:gsqYFH8bb9ekPA12kRo0hfjngWQjkJPlN9R0N78BoUo=
|
||||
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
github.com/urfave/cli/v2 v2.1.1 h1:Qt8FeAtxE/vfdrLmR3rxR6JRE0RoVmbXu8+6kZtYU4k=
|
||||
github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ=
|
||||
github.com/urfave/cli/v2 v2.2.0 h1:JTTnM6wKzdA0Jqodd966MVj4vWbbquZykeX1sKbe2C4=
|
||||
github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ=
|
||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc=
|
||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200918174421-af09f7315aff h1:1CPUrky56AcgSpxz/KfgzQWzfG09u5YOL8MvPYBlrL8=
|
||||
golang.org/x/sys v0.0.0-20200918174421-af09f7315aff/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
|
@ -1,4 +1,4 @@
|
||||
package commands
|
||||
package command
|
||||
|
||||
import (
|
||||
"net/url"
|
@ -1,4 +1,4 @@
|
||||
package commands
|
||||
package command
|
||||
|
||||
import "testing"
|
||||
|
@ -1,4 +1,4 @@
|
||||
package commands
|
||||
package command
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -1,4 +1,4 @@
|
||||
package commands
|
||||
package command
|
||||
|
||||
import (
|
||||
"flag"
|
@ -1,4 +1,4 @@
|
||||
package commands
|
||||
package command
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -1,4 +1,4 @@
|
||||
package commands
|
||||
package command
|
||||
|
||||
import (
|
||||
"flag"
|
@ -1,4 +1,4 @@
|
||||
package commands
|
||||
package command
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -1,4 +1,4 @@
|
||||
package commands
|
||||
package command
|
||||
|
||||
import (
|
||||
"flag"
|
@ -1,4 +1,4 @@
|
||||
package commands
|
||||
package command
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -1,4 +1,4 @@
|
||||
package commands
|
||||
package command
|
||||
|
||||
import (
|
||||
"flag"
|
@ -1,4 +1,4 @@
|
||||
package commands
|
||||
package command
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -1,4 +1,4 @@
|
||||
package commands
|
||||
package command
|
||||
|
||||
import (
|
||||
"flag"
|
@ -1,4 +1,4 @@
|
||||
package commands
|
||||
package command
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -1,4 +1,4 @@
|
||||
package commands
|
||||
package command
|
||||
|
||||
import (
|
||||
"flag"
|
@ -1,4 +1,4 @@
|
||||
package commands
|
||||
package command
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -1,4 +1,4 @@
|
||||
package commands
|
||||
package command
|
||||
|
||||
import (
|
||||
"flag"
|
@ -1,4 +1,4 @@
|
||||
package commands
|
||||
package command
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -1,4 +1,4 @@
|
||||
package commands
|
||||
package command
|
||||
|
||||
import (
|
||||
"flag"
|
@ -1,4 +1,4 @@
|
||||
package commands
|
||||
package command
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -1,4 +1,4 @@
|
||||
package commands
|
||||
package command
|
||||
|
||||
import (
|
||||
"flag"
|
Loading…
Reference in New Issue
Block a user