mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-14 20:22:13 -04:00
add coordinator count to cli
This commit is contained in:
parent
dbfbdfe3cd
commit
8b7bafb482
13 changed files with 232 additions and 145 deletions
|
@ -21,7 +21,7 @@ func isIntArg(arg int) cobra.PositionalArgs {
|
|||
}
|
||||
}
|
||||
|
||||
// isIntGreaterArg checks if argument at position arg is and integer and greater i.
|
||||
// isIntGreaterArg checks if argument at position arg is an integer and greater i.
|
||||
func isIntGreaterArg(arg int, i int) cobra.PositionalArgs {
|
||||
return cobra.MatchAll(isIntArg(arg), func(cmd *cobra.Command, args []string) error {
|
||||
if v, _ := strconv.Atoi(args[arg]); v <= i {
|
||||
|
@ -31,6 +31,16 @@ func isIntGreaterArg(arg int, i int) cobra.PositionalArgs {
|
|||
})
|
||||
}
|
||||
|
||||
// isValidAWSCoordinatorCount checks if argument at position arg is an integer exactly 1.
|
||||
func isValidAWSCoordinatorCount(arg int) cobra.PositionalArgs {
|
||||
return cobra.MatchAll(isIntArg(arg), func(cmd *cobra.Command, args []string) error {
|
||||
if v, _ := strconv.Atoi(args[arg]); v != 1 {
|
||||
return fmt.Errorf("argument %d is %d, that is not a valid coordinator count for AWS, currently the only supported coordinator count is 1", arg, v)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// isIntGreaterZeroArg checks if argument at position arg is a positive non zero integer.
|
||||
func isIntGreaterZeroArg(arg int) cobra.PositionalArgs {
|
||||
return cobra.MatchAll(isIntGreaterArg(arg, 0))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue