Skip to content

Commit

Permalink
style: solves #6
Browse files Browse the repository at this point in the history
  • Loading branch information
matfax committed Jan 14, 2019
1 parent 357acee commit f03e900
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion cmd/tuplip/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type buildCmd struct {
// CheckSemver flag enables semantic version checks
CheckSemver bool `short:"c" help:"check versioned tag vectors for valid semantic version syntax"`
// From command determines the source of the tag vectors.
From sourceOption `cmd help:"determine the source of the tag vectors"`
From sourceOption `cmd:"" help:"determine the source of the tag vectors"`
}

// run implements main.rootCmd.run by executing the build.
Expand Down
26 changes: 13 additions & 13 deletions cmd/tuplip/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,30 @@ type rootCmd interface {

// tuplipContext provides the options and the interface to the tupliplib.
type tuplipContext struct {
tupliplib.Tuplip `embed`
tupliplib.Tuplip `embed:""`
}

// sourceOption defines a command branch to determine the source of the tag vectors.
type sourceOption struct {
stdinOption `embed`
fileOption `embed`
paramOption `embed`
stdinOption `embed:""`
fileOption `embed:""`
paramOption `embed:""`
}

// fromRepositoryOption defines a command branch to determine the source of the tag vectors and a repository name.
type fromRepositoryOption struct {
// From command determines the source of the tag vectors.
From fileOption `cmd help:"determine the source of the tag vectors"`
From fileOption `cmd:"" help:"determine the source of the tag vectors"`
// Repository opens a positional argument in the command.
Repository struct {
// From command determines the source of the tag vectors that need the repository.
From struct {
stdinOption `embed`
paramOption `embed`
} `cmd help:"determine the source of the tag vectors"`
stdinOption `embed:""`
paramOption `embed:""`
} `cmd:"" help:"determine the source of the tag vectors"`
// Repository is the Docker Hub repository of the root tag vector in the format `organization/repository`.
Repository string `arg env:"DOCKER_REPOSITORY" help:"the Docker Hub repository of the root tag vector in the format 'organization/repository'"`
} `arg`
Repository string `arg:"" env:"DOCKER_REPOSITORY" help:"the Docker Hub repository of the root tag vector in the format 'organization/repository'"`
} `arg:""`
}

// sourceTagOption defines a command branch to determine the source of the tag vectors, repository name, and source tag.
Expand All @@ -52,10 +52,10 @@ type sourceTagOption struct {
CheckSemver bool `short:"c" help:"check versioned tag vectors for valid semantic version syntax"`
// SourceTag opens a positional argument in the command.
SourceTag struct {
fromRepositoryOption `embed`
fromRepositoryOption `embed:""`
// SourceTag is the tag of the source image that is to be tagged.
SourceTag string `arg help:"the source tag of the image that should receive the generated tags"`
} `arg`
SourceTag string `arg:"" help:"the source tag of the image that should receive the generated tags"`
} `arg:""`
}

// toRoot determines the root command and passes the given tuplip source to it.
Expand Down
6 changes: 3 additions & 3 deletions cmd/tuplip/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import (
// fileOption defines a command branch that contains only the file command.
type fileOption struct {
// File to read the tag vectors from a Dockerfile.
File fileCmd `cmd help:"read the tag vectors from a Dockerfile"`
File fileCmd `cmd:"" help:"read the tag vectors from a Dockerfile"`
}

// fileCmd defines a command to read tag vectors from a Dockerfile.
type fileCmd struct {
Context tuplipContext `embed`
Context tuplipContext `embed:""`
// File is the Dockerfile that contains the vectors as FROM instructions.
File string `arg type:"existingfile" default:"Dockerfile" help:"the Dockerfile containing the vectors as FROM instructions"`
File string `arg:"" type:"existingfile" default:"Dockerfile" help:"the Dockerfile containing the vectors as FROM instructions"`
}

// Run implements a dynamic interface from kong by executing a command using given file argument as input.
Expand Down
2 changes: 1 addition & 1 deletion cmd/tuplip/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

// findCmd contains the options for the find command.
type findCmd struct {
fromRepositoryOption `embed`
fromRepositoryOption `embed:""`
}

// run implements main.rootCmd.run by executing the find.
Expand Down
2 changes: 1 addition & 1 deletion cmd/tuplip/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ For more information, visit the GitHub project https://github.com/gofunky/tuplip

// helpCmd contains the options for the help command.
type helpCmd struct {
Command []string `arg optional help:"the commands for which to show help" sep:" "`
Command []string `arg:"" optional:"" help:"the commands for which to show help" sep:" "`
}

// Run shows help.
Expand Down
10 changes: 5 additions & 5 deletions cmd/tuplip/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
// cli references the cli command objects.
var cli struct {
Version versionCmd `cmd help:"display the app version"`
Help helpCmd `cmd help:"show help for a command"`
Build buildCmd `cmd help:"build Docker tags from the given tag vectors"`
Tag tagCmd `cmd help:"tag the given source image with the Docker tags from the given tag vectors"`
Push pushCmd `cmd help:"tag and push the given source image with the Docker tags from the given tag vectors"`
Find findCmd `cmd help:"find the most appropriate Docker tag in the given repository"`
Help helpCmd `cmd:"" help:"show help for a command"`
Build buildCmd `cmd:"" help:"build Docker tags from the given tag vectors"`
Tag tagCmd `cmd:"" help:"tag the given source image with the Docker tags from the given tag vectors"`
Push pushCmd `cmd:"" help:"tag and push the given source image with the Docker tags from the given tag vectors"`
Find findCmd `cmd:"" help:"find the most appropriate Docker tag in the given repository"`
}

// main builds a command factory and starts it for the binary.
Expand Down
6 changes: 3 additions & 3 deletions cmd/tuplip/param.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import (
// paramOption defines a command branch that contains only the param command.
type paramOption struct {
// Param to pass the tag vectors as arguments.
Param paramCmd `arg help:"pass the tag vectors as arguments"`
Param paramCmd `arg:"" help:"pass the tag vectors as arguments"`
}

// paramCmd defines a command to pass the tag vectors as parameter.
type paramCmd struct {
Context tuplipContext `embed`
Context tuplipContext `embed:""`
// Param is the parameter that contains the tag vectors.
Param []string `arg help:"the space-separated list of tag vectors"`
Param []string `arg:"" help:"the space-separated list of tag vectors"`
}

// Run implements a dynamic interface from kong by executing a command using given param argument as input.
Expand Down
2 changes: 1 addition & 1 deletion cmd/tuplip/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

// pushCmd contains the options for the push command.
type pushCmd struct {
sourceTagOption `embed`
sourceTagOption `embed:""`
}

// run implements main.rootCmd.run by executing the tagging, and then the pushing process.
Expand Down
6 changes: 3 additions & 3 deletions cmd/tuplip/stdin.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import (
// stdinOption defines a command branch that contains only the stdin command.
type stdinOption struct {
// Stdin is used to read the tag vectors.
Stdin stdinCmd `cmd help:"read the tag vectors from the standard input"`
Stdin stdinCmd `cmd:"" help:"read the tag vectors from the standard input"`
}

// stdinCmd defines a command to read tag vectors from a standard input.
type stdinCmd struct {
Context tuplipContext `embed`
Context tuplipContext `embed:""`
// Separator that splits the separate tag vectors. The default separator is a single space.
Separator string `optional short:"s" env:"IFS" default:" " help:"the separator that splits the separate tag vectors from the stdin"`
Separator string `optional:"" short:"s" env:"IFS" default:" " help:"the separator that splits the separate tag vectors from the stdin"`
}

// Run implements a dynamic interface from kong by executing a command using the stdin as input.
Expand Down
2 changes: 1 addition & 1 deletion cmd/tuplip/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

// tagCmd contains the options for the tag command.
type tagCmd struct {
sourceTagOption `embed`
sourceTagOption `embed:""`
}

// run implements main.rootCmd.run by executing the tagging process.
Expand Down

0 comments on commit f03e900

Please sign in to comment.