mirror of
https://github.com/thegeeklab/url-parser.git
synced 2024-11-17 18:50:42 +00:00
fix gitignore exclude
This commit is contained in:
parent
fa6ce3ea25
commit
8cb686144c
@ -63,7 +63,6 @@ def binaries(arch):
|
||||
'commands': [
|
||||
'[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}',
|
||||
'mkdir -p release/',
|
||||
"ls -lh",
|
||||
"xgo -ldflags \"-X main.Version=$BUILD_VERSION\" -tags netgo -targets 'linux/amd64,linux/arm-6,linux/arm64' -out url-parser-$BUILD_VERSION ./cmd/url-parser",
|
||||
'cp /build/* release/'
|
||||
]
|
||||
|
@ -39,7 +39,6 @@ steps:
|
||||
commands:
|
||||
- "[ -z \"${DRONE_TAG}\" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}"
|
||||
- mkdir -p release/
|
||||
- ls -lh
|
||||
- xgo -ldflags "-X main.Version=$BUILD_VERSION" -tags netgo -targets 'linux/amd64,linux/arm-6,linux/arm64' -out url-parser-$BUILD_VERSION ./cmd/url-parser
|
||||
- cp /build/* release/
|
||||
|
||||
@ -112,6 +111,6 @@ depends_on:
|
||||
|
||||
---
|
||||
kind: signature
|
||||
hmac: 09c4c7b333827ec19925d9d33aae7c014f9dbfc8b35f2078419de0ba0a30c19a
|
||||
hmac: 3c27762ebfb16c87206081475353f598923952f31bf58defe136a142c4dd0959
|
||||
|
||||
...
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -13,4 +13,4 @@
|
||||
|
||||
# Dependency directories (remove the comment below to include it)
|
||||
# vendor/
|
||||
url-parser
|
||||
/url-parser
|
||||
|
56
cmd/url-parser/config.go
Normal file
56
cmd/url-parser/config.go
Normal file
@ -0,0 +1,56 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/urfave/cli/v2"
|
||||
"github.com/xoxys/url-parser/commands"
|
||||
)
|
||||
|
||||
func globalFlags() []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "url",
|
||||
Usage: "source url to parse",
|
||||
EnvVars: []string{"URL_PARSER_URL"},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configCommands() []*cli.Command {
|
||||
return []*cli.Command{
|
||||
{
|
||||
Name: "all",
|
||||
Aliases: []string{"a"},
|
||||
Usage: "print out all parts from url",
|
||||
Action: commands.Run,
|
||||
Flags: globalFlags(),
|
||||
},
|
||||
{
|
||||
Name: "scheme",
|
||||
Aliases: []string{"s"},
|
||||
Usage: "print out scheme from url",
|
||||
Action: commands.Scheme,
|
||||
Flags: globalFlags(),
|
||||
},
|
||||
{
|
||||
Name: "user",
|
||||
Aliases: []string{"u"},
|
||||
Usage: "print out username from url",
|
||||
Action: commands.User,
|
||||
Flags: globalFlags(),
|
||||
},
|
||||
{
|
||||
Name: "password",
|
||||
Aliases: []string{"p"},
|
||||
Usage: "print out password from url",
|
||||
Action: commands.Password,
|
||||
Flags: globalFlags(),
|
||||
},
|
||||
{
|
||||
Name: "path",
|
||||
Aliases: []string{"pt"},
|
||||
Usage: "print out the path from url",
|
||||
Action: commands.Path,
|
||||
Flags: append(globalFlags(), commands.PathFlags()...),
|
||||
},
|
||||
}
|
||||
}
|
27
cmd/url-parser/main.go
Normal file
27
cmd/url-parser/main.go
Normal file
@ -0,0 +1,27 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/urfave/cli/v2"
|
||||
"github.com/xoxys/url-parser/commands"
|
||||
)
|
||||
|
||||
var (
|
||||
version = "0.1.0"
|
||||
)
|
||||
|
||||
func main() {
|
||||
app := cli.NewApp()
|
||||
app.Name = "url-parser"
|
||||
app.Usage = "Parse URL and shows the part of it."
|
||||
app.Version = version
|
||||
app.Action = commands.Run
|
||||
app.Flags = globalFlags()
|
||||
app.Commands = configCommands()
|
||||
|
||||
if err := app.Run(os.Args); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user