mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
coder features list CLI command (#3533)
* AGPL Entitlements API Signed-off-by: Spike Curtis <spike@coder.com> * Generate typesGenerated.ts Signed-off-by: Spike Curtis <spike@coder.com> * AllFeatures -> FeatureNames Signed-off-by: Spike Curtis <spike@coder.com> * Features CLI command Signed-off-by: Spike Curtis <spike@coder.com> * Validate columns Signed-off-by: Spike Curtis <spike@coder.com> * Tests for features list CLI command Signed-off-by: Spike Curtis <spike@coder.com> * Drop empty EntitlementsRequest Signed-off-by: Spike Curtis <spike@coder.com> * Fix dump.sql generation Signed-off-by: Spike Curtis <spike@coder.com> Signed-off-by: Spike Curtis <spike@coder.com>
This commit is contained in:
@@ -301,3 +301,19 @@ func valueToTableMap(val reflect.Value) (map[string]any, error) {
|
||||
|
||||
return row, nil
|
||||
}
|
||||
|
||||
func ValidateColumns(all, given []string) error {
|
||||
for _, col := range given {
|
||||
found := false
|
||||
for _, c := range all {
|
||||
if strings.EqualFold(strings.ReplaceAll(col, "_", " "), c) {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
return fmt.Errorf("unknown column: %s", col)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user