diff --git a/shortcuts/common/runner.go b/shortcuts/common/runner.go index 079a2c863..2906830e4 100644 --- a/shortcuts/common/runner.go +++ b/shortcuts/common/runner.go @@ -210,12 +210,6 @@ func (ctx *RuntimeContext) Int(name string) int { return v } -// Int64 returns an int64 flag value. -func (ctx *RuntimeContext) Int64(name string) int64 { - v, _ := ctx.Cmd.Flags().GetInt64(name) - return v -} - // Float64 returns a float64 flag value (non-integer numbers). func (ctx *RuntimeContext) Float64(name string) float64 { v, _ := ctx.Cmd.Flags().GetFloat64(name) @@ -1087,10 +1081,6 @@ func registerShortcutFlagsWithContext(ctx context.Context, cmd *cobra.Command, f var d int fmt.Sscanf(fl.Default, "%d", &d) cmd.Flags().Int(fl.Name, d, desc) - case "int64": - var d int64 - fmt.Sscanf(fl.Default, "%d", &d) - cmd.Flags().Int64(fl.Name, d, desc) case "float64": var d float64 fmt.Sscanf(fl.Default, "%g", &d) diff --git a/shortcuts/common/types.go b/shortcuts/common/types.go index 0abe1d70f..86eb80b74 100644 --- a/shortcuts/common/types.go +++ b/shortcuts/common/types.go @@ -18,7 +18,7 @@ const ( // Flag describes a CLI flag for a shortcut. type Flag struct { Name string // flag name (e.g. "calendar-id") - Type string // "string" (default) | "bool" | "int" | "int64" | "float64" | "string_array" | "string_slice" + Type string // "string" (default) | "bool" | "int" | "float64" | "string_array" | "string_slice" Default string // default value as string Desc string // help text Hidden bool // hidden from --help, still readable at runtime diff --git a/shortcuts/sheets/flag_view.go b/shortcuts/sheets/flag_view.go index c369d538e..3c799bba8 100644 --- a/shortcuts/sheets/flag_view.go +++ b/shortcuts/sheets/flag_view.go @@ -21,7 +21,6 @@ import ( type flagView interface { Str(name string) string Int(name string) int - Int64(name string) int64 Float64(name string) float64 Bool(name string) bool StrArray(name string) []string @@ -90,10 +89,6 @@ func typedDefault(df flagDef) interface{} { var n int fmt.Sscanf(df.Default, "%d", &n) return n - case "int64": - var n int64 - fmt.Sscanf(df.Default, "%d", &n) - return n case "float64": var f float64 fmt.Sscanf(df.Default, "%g", &f) @@ -175,22 +170,6 @@ func (m mapFlagView) Int(name string) int { return 0 } -func (m mapFlagView) Int64(name string) int64 { - v, ok := m.lookup(name) - if !ok { - return 0 - } - switch t := v.(type) { - case float64: - return int64(t) - case int: - return int64(t) - case int64: - return t - } - return 0 -} - func (m mapFlagView) Float64(name string) float64 { v, ok := m.lookup(name) if !ok { @@ -257,7 +236,7 @@ func (m mapFlagView) Changed(name string) bool { // validateRawTypes rejects sub-op input fields whose JSON type contradicts the // flag's declared type in flag-defs. +batch-update skips parse-time schema -// validation for `operations`, and Int/Int64/Float64/Bool silently fall back to +// validation for `operations`, and Int/Float64/Bool silently fall back to // the zero value on a type mismatch — so without this guard a wrong-typed scalar // (e.g. "index":"abc" or "multiple":"true") would land as 0 / false instead of // erroring, writing to the wrong place. Only numeric and boolean flags are @@ -294,7 +273,7 @@ func (m mapFlagView) validateRawTypes() error { continue // unknown key — leave it for the translator / schema layer } switch typ { - case "int", "int64", "float64": + case "int", "float64": if _, isNum := val.(float64); !isNum { return fmt.Errorf("--%s must be a number, got %s", name, jsonTypeName(val)) }