Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix invalid cli path #3

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions cmd/job/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@ import (
"fmt"
"os"

gocli "github.com/nicholasgasior/go-broccli"
"github.com/mikolajgs/broccli"
)

func main() {
cli := gocli.NewCLI("job", "Run job locally", "Streamln <hello@streamln.dev>")
cli := broccli.NewCLI("job", "Run job locally", "Streamln <hello@streamln.dev>")
cmdRun := cli.AddCmd("run-local", "Runs YAML job file", runJobHandler)
cmdRun.AddFlag("job", "j", "FILENAME", "Path to filename with a job", gocli.TypePathFile, gocli.IsRequired|gocli.IsExistent|gocli.IsRegularFile)
cmdRun.AddFlag("inputs", "i", "FILENAME", "Path to file containing input values", gocli.TypePathFile, gocli.IsRequired|gocli.IsExistent|gocli.IsRegularFile)
cmdRun.AddFlag("quiet", "q", "", "Do not print step stdout and stderr", gocli.TypeBool, 0, gocli.OnTrue(func(c *gocli.Cmd) {
cmdRun.AddFlag("job", "j", "FILENAME", "Path to filename with a job", broccli.TypePathFile, broccli.IsRequired|broccli.IsExistent|broccli.IsRegularFile)
cmdRun.AddFlag("inputs", "i", "FILENAME", "Path to file containing input values", broccli.TypePathFile, broccli.IsRequired|broccli.IsExistent|broccli.IsRegularFile)
cmdRun.AddFlag("quiet", "q", "", "Do not print step stdout and stderr", broccli.TypeBool, 0, broccli.OnTrue(func(c *broccli.Cmd) {

}))
cmdRun.AddFlag("result", "r", "FILENAME", "Path to write JSON result", gocli.TypePathFile, 0)
cmdRun.AddFlag("result", "r", "FILENAME", "Path to write JSON result", broccli.TypePathFile, 0)
_ = cli.AddCmd("version", "Prints version", versionHandler)
if len(os.Args) == 2 && (os.Args[1] == "-v" || os.Args[1] == "--version") {
os.Args = []string{"App", "version"}
}
os.Exit(cli.Run())
}

func versionHandler(c *gocli.CLI) int {
func versionHandler(c *broccli.CLI) int {
fmt.Fprintf(os.Stdout, VERSION+"\n")
return 0
}

func runJobHandler(c *gocli.CLI) int {
func runJobHandler(c *broccli.CLI) int {
jobFile := c.Flag("job")
j, err := job.NewFromFile(jobFile)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ toolchain go1.22.1

require (
github.com/docker/docker v25.0.3+incompatible
github.com/nicholasgasior/go-broccli v2.0.0+incompatible
github.com/nicholasgasior/struct-validator v0.3.0
github.com/mikolajgs/broccli v2.0.0+incompatible
github.com/mikolajgs/struct-validator v0.3.1
github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mikolajgs/broccli v2.0.0+incompatible h1:zpLdjMIA9QrUtcXQqjFi3WCY3P8n+/45VHRAc2bfZ4c=
github.com/mikolajgs/broccli v2.0.0+incompatible/go.mod h1:IOqvFr2wSjX/7otXFff5+jOdyWVXi5OsKEJ5viXk/vg=
github.com/mikolajgs/struct-validator v0.3.1 h1:cvYDqEcv9ut8QIVwpj/i3z6iw8inpxvq8GxDcwXj4jo=
github.com/mikolajgs/struct-validator v0.3.1/go.mod h1:Ks0Lm870PpN0ZuQ+LDKYhCazSNyN3zvX5NrFxwlS69g=
github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk=
github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc=
github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8=
Expand All @@ -105,10 +109,6 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus=
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
github.com/nicholasgasior/go-broccli v2.0.0+incompatible h1:5tyBPdc9C4QGpZP2U7rNj3ZVdUCKkjJ8Qw9PsLNgQ8I=
github.com/nicholasgasior/go-broccli v2.0.0+incompatible/go.mod h1:HXVuYqjA19/qowITJDKRqz7+JPDwt2CExGBwHYF/zLA=
github.com/nicholasgasior/struct-validator v0.3.0 h1:F1Fo1QcFocoGUueMTCoY93k//0JNeISCXZuuYDvbiV0=
github.com/nicholasgasior/struct-validator v0.3.0/go.mod h1:oQqrQT/Yone5ST7wCemvoAxUOrL5kzbUrqglDho1AGc=
github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY=
github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM=
github.com/onsi/gomega v1.31.0 h1:54UJxxj6cPInHS3a35wm6BK/F9nHYueZ1NVujHDrnXE=
Expand Down
2 changes: 1 addition & 1 deletion pkg/input/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package input

import (
structvalidator "github.com/nicholasgasior/struct-validator"
structvalidator "github.com/mikolajgs/struct-validator"
_ "gopkg.in/yaml.v2"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/job/validate.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package job

import structvalidator "github.com/nicholasgasior/struct-validator"
import structvalidator "github.com/mikolajgs/struct-validator"

func (j *Job) Validate() (bool, map[string]int) {
isValid, failedFields := structvalidator.Validate(j, &structvalidator.ValidationOptions{})
Expand Down
2 changes: 1 addition & 1 deletion pkg/output/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package output

import (
structvalidator "github.com/nicholasgasior/struct-validator"
structvalidator "github.com/mikolajgs/struct-validator"
_ "gopkg.in/yaml.v2"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/step/shell/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package shellstep

import (
structvalidator "github.com/nicholasgasior/struct-validator"
structvalidator "github.com/mikolajgs/struct-validator"
)

type ShellStep struct {
Expand Down