-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a tool to update mint leaf versions (#46)
Co-authored-by: Pierre Beaucamp <[email protected]> Co-authored-by: Pierre Beaucamp <[email protected]> Co-authored-by: Tommy Graves <[email protected]>
- Loading branch information
1 parent
6f4c962
commit af2e3a6
Showing
10 changed files
with
657 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
golang 1.20 | ||
golang 1.22.1 | ||
golangci-lint 1.57.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/rwx-research/mint-cli/internal/cli" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var leavesCmd = &cobra.Command{ | ||
Short: "Manage Mint leaves", | ||
Use: "leaves", | ||
} | ||
|
||
var ( | ||
Files []string | ||
AllowMajorVersionChange bool | ||
|
||
leavesUpdateCmd = &cobra.Command{ | ||
PreRunE: func(cmd *cobra.Command, args []string) error { | ||
return requireAccessToken() | ||
}, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
replacementVersionPicker := cli.PickLatestMinorVersion | ||
if AllowMajorVersionChange { | ||
replacementVersionPicker = cli.PickLatestMajorVersion | ||
} | ||
|
||
return service.UpdateLeaves(cli.UpdateLeavesConfig{ | ||
Files: args, | ||
DefaultDir: ".mint", | ||
ReplacementVersionPicker: replacementVersionPicker, | ||
Stdout: os.Stdout, | ||
Stderr: os.Stderr, | ||
}) | ||
}, | ||
Short: "Update all leaves to their latest (minor) version", | ||
Long: "Update all leaves to their latest (minor) version.\n" + | ||
"Takes a list of files as arguments, or updates all toplevel YAML files in .mint if no files are given.", | ||
Use: "update [flags] [file...]", | ||
} | ||
) | ||
|
||
func init() { | ||
leavesUpdateCmd.Flags().BoolVar(&AllowMajorVersionChange, "allow-major-version-change", false, "update leaves to the latest major version") | ||
leavesCmd.AddCommand(leavesUpdateCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.