Skip to content

Commit

Permalink
Merge pull request #34 from k1LoW/registry-option
Browse files Browse the repository at this point in the history
Add `--registry` option for specifying the registry to use.
  • Loading branch information
linyows authored Oct 12, 2023
2 parents 245781f + 9da6b02 commit 29073c3
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ type cli struct {
Interval int `long:"interval" arg:"seconds" short:"i" description:"The polling interval to the repository (default: 10)"`
Port string `long:"port" short:"p" description:"TCP port to listen"`
Repository string `long:"repository" short:"r" description:"Repository for application"`
Artifact string `long:"artifact" short:"a" description:"Artifact for application"`
Registry string `long:"registry" description:"Registry for application"`
Artifact string `long:"artifact" short:"a" description:"Artifact name for application"`
PreRelease bool `long:"pre" short:"P" description:"Pre-release handling (default: false)"`
Help bool `long:"help" short:"h" description:"show this help message and exit"`
Version bool `long:"version" short:"v" description:"prints the version number"`
Expand Down Expand Up @@ -106,6 +107,7 @@ func (c *cli) showHelp() {
opts := strings.Join(c.buildHelp([]string{
"Config",
"Interval",
"Registry",
"Repository",
"Artifact",
"Port",
Expand Down Expand Up @@ -170,13 +172,16 @@ func (c *cli) run() int {

conf := DefaultConfig()

if c.Repository == "" {
fmt.Fprintf(c.env.Err, "Error: --repository is not set\n")
if c.Registry == "" && c.Repository == "" {
fmt.Fprintf(c.env.Err, "Error: --registry is not set\n")
c.showHelp()
return ExitErr
}
// --repository is sintax sugar for --registry github_release://
conf.Registry = fmt.Sprintf("%s://%s", ghrelease.Scheme, c.Repository)
if c.Registry == "" && c.Repository != "" {
// --repository is sintax sugar for --registry github_release://
conf.Registry = fmt.Sprintf("%s://%s", ghrelease.Scheme, c.Repository)
}

conf.ArtifactName = c.Artifact
conf.PreRelease = c.PreRelease

Expand Down

0 comments on commit 29073c3

Please sign in to comment.