Skip to content

Commit

Permalink
Update cli lib path
Browse files Browse the repository at this point in the history
  • Loading branch information
mikogs committed Jul 16, 2024
1 parent f6e06f4 commit 0ce0019
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module github.com/Cardinal-Cryptography/github-actions-validator
go 1.19

require (
github.com/nicholasgasior/go-broccli v2.0.0+incompatible
github.com/mikolajgs/broccli v2.0.0+incompatible
gopkg.in/yaml.v2 v2.4.0
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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/mikolajgs/broccli v2.0.0+incompatible h1:zpLdjMIA9QrUtcXQqjFi3WCY3P8n+/45VHRAc2bfZ4c=
github.com/mikolajgs/broccli v2.0.0+incompatible/go.mod h1:IOqvFr2wSjX/7otXFff5+jOdyWVXi5OsKEJ5viXk/vg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
Expand Down
14 changes: 7 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@ package main

import (
"fmt"
gocli "github.com/nicholasgasior/go-broccli"
"github.com/mikolajgs/broccli"
"os"

"github.com/Cardinal-Cryptography/github-actions-validator/pkg/dotgithub"
)

func main() {
cli := gocli.NewCLI("github-actions-validator", "Validates GitHub Actions' .github directory", "devops@cc")
cli := broccli.NewCLI("github-actions-validator", "Validates GitHub Actions' .github directory", "infra-team@cardinals")
cmdValidate := cli.AddCmd("validate", "Runs the validation on files from a specified directory", validateHandler)
cmdValidate.AddFlag("path", "p", "", "Path to .github directory", gocli.TypePathFile, gocli.IsDirectory|gocli.IsExistent|gocli.IsRequired)
cmdValidate.AddFlag("vars-file", "z", "", "Check if variable names exist in this file (one per line)", gocli.TypePathFile, gocli.IsExistent)
cmdValidate.AddFlag("secrets-file", "s", "", "Check if secret names exist in this file (one per line)", gocli.TypePathFile, gocli.IsExistent)
cmdValidate.AddFlag("path", "p", "", "Path to .github directory", broccli.TypePathFile, broccli.IsDirectory|broccli.IsExistent|broccli.IsRequired)
cmdValidate.AddFlag("vars-file", "z", "", "Check if variable names exist in this file (one per line)", broccli.TypePathFile, broccli.IsExistent)
cmdValidate.AddFlag("secrets-file", "s", "", "Check if secret names exist in this file (one per line)", broccli.TypePathFile, broccli.IsExistent)
_ = 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 validateHandler(c *gocli.CLI) int {
func validateHandler(c *broccli.CLI) int {
dotGithub := dotgithub.DotGithub{
Path: c.Flag("path"),
VarsFile: c.Flag("vars-file"),
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package main

const VERSION = "0.5.1"
const VERSION = "0.5.2"

0 comments on commit 0ce0019

Please sign in to comment.