@@ -261,6 +261,24 @@ type Argument interface {
261261}
262262 Argument captures a positional argument that can be parsed
263263
264+ type ArgumentBase[T any, C any, VC ValueCreator[T, C]] struct {
265+ Name string `json:"name"` // the name of this argument
266+ Value T `json:"value"` // the default value of this argument
267+ Destination *T `json:"-"` // the destination point for this argument
268+ UsageText string `json:"usageText"` // the usage text to show
269+ Config C `json:"config"` // config for this argument similar to Flag Config
270+
271+ // Has unexported fields.
272+ }
273+
274+ func (a *ArgumentBase[T, C, VC]) Get() any
275+
276+ func (a *ArgumentBase[T, C, VC]) HasName(s string) bool
277+
278+ func (a *ArgumentBase[T, C, VC]) Parse(s []string) ([]string, error)
279+
280+ func (a *ArgumentBase[T, C, VC]) Usage() string
281+
264282type ArgumentsBase[T any, C any, VC ValueCreator[T, C]] struct {
265283 Name string `json:"name"` // the name of this argument
266284 Value T `json:"value"` // the default value of this argument
@@ -272,6 +290,7 @@ type ArgumentsBase[T any, C any, VC ValueCreator[T, C]] struct {
272290
273291 // Has unexported fields.
274292}
293+ ArgumentsBase is a base type for slice arguments
275294
276295func (a *ArgumentsBase[T, C, VC]) Get() any
277296
@@ -509,6 +528,8 @@ func (cmd *Command) FlagNames() []string
509528func (cmd *Command) Float(name string) float64
510529 Float looks up the value of a local FloatFlag, returns 0 if not found
511530
531+ func (c *Command) FloatArg(name string) float64
532+
512533func (c *Command) FloatArgs(name string) []float64
513534
514535func (cmd *Command) FloatSlice(name string) []float64
@@ -528,6 +549,8 @@ func (cmd *Command) HasName(name string) bool
528549func (cmd *Command) Int(name string) int
529550 Int looks up the value of a local Int64Flag, returns 0 if not found
530551
552+ func (c *Command) IntArg(name string) int64
553+
531554func (c *Command) IntArgs(name string) []int64
532555
533556func (cmd *Command) IntSlice(name string) []int64
@@ -566,6 +589,8 @@ func (cmd *Command) Set(name, value string) error
566589
567590func (cmd *Command) String(name string) string
568591
592+ func (c *Command) StringArg(name string) string
593+
569594func (c *Command) StringArgs(name string) []string
570595
571596func (cmd *Command) StringMap(name string) map[string]string
@@ -579,6 +604,8 @@ func (cmd *Command) StringSlice(name string) []string
579604func (cmd *Command) Timestamp(name string) time.Time
580605 Timestamp gets the timestamp from a flag name
581606
607+ func (c *Command) TimestampArg(name string) time.Time
608+
582609func (c *Command) TimestampArgs(name string) []time.Time
583610
584611func (cmd *Command) ToFishCompletion() (string, error)
@@ -588,6 +615,8 @@ func (cmd *Command) ToFishCompletion() (string, error)
588615func (cmd *Command) Uint(name string) uint
589616 Uint looks up the value of a local Uint64Flag, returns 0 if not found
590617
618+ func (c *Command) UintArg(name string) uint64
619+
591620func (c *Command) UintArgs(name string) []uint64
592621
593622func (cmd *Command) UintSlice(name string) []uint64
@@ -906,6 +935,8 @@ func (f FlagsByName) Less(i, j int) bool
906935
907936func (f FlagsByName) Swap(i, j int)
908937
938+ type FloatArg = ArgumentBase[float64, NoConfig, floatValue]
939+
909940type FloatArgs = ArgumentsBase[float64, NoConfig, floatValue]
910941
911942type FloatFlag = FlagBase[float64, NoConfig, floatValue]
@@ -916,6 +947,8 @@ type FloatSliceFlag = FlagBase[[]float64, NoConfig, FloatSlice]
916947
917948type GenericFlag = FlagBase[Value, NoConfig, genericValue]
918949
950+ type IntArg = ArgumentBase[int64, IntegerConfig, intValue]
951+
919952type IntArgs = ArgumentsBase[int64, IntegerConfig, intValue]
920953
921954type Int16SliceFlag = FlagBase[[]int16, IntegerConfig, Int16Slice]
@@ -1081,6 +1114,8 @@ func (i SliceBase[T, C, VC]) ToString(t []T) string
10811114func (i *SliceBase[T, C, VC]) Value() []T
10821115 Value returns the slice of values set by this flag
10831116
1117+ type StringArg = ArgumentBase[string, StringConfig, stringValue]
1118+
10841119type StringArgs = ArgumentsBase[string, StringConfig, stringValue]
10851120
10861121type StringConfig struct {
@@ -1093,7 +1128,7 @@ type StringFlag = FlagBase[string, StringConfig, stringValue]
10931128
10941129type StringMap = MapBase[string, StringConfig, stringValue]
10951130
1096- type StringMapArgs = ArgumentsBase [map[string]string, StringConfig, StringMap]
1131+ type StringMapArgs = ArgumentBase [map[string]string, StringConfig, StringMap]
10971132
10981133type StringMapFlag = FlagBase[map[string]string, StringConfig, StringMap]
10991134
@@ -1105,6 +1140,8 @@ type SuggestCommandFunc func(commands []*Command, provided string) string
11051140
11061141type SuggestFlagFunc func(flags []Flag, provided string, hideHelp bool) string
11071142
1143+ type TimestampArg = ArgumentBase[time.Time, TimestampConfig, timestampValue]
1144+
11081145type TimestampArgs = ArgumentsBase[time.Time, TimestampConfig, timestampValue]
11091146
11101147type TimestampConfig struct {
@@ -1120,6 +1157,8 @@ type TimestampConfig struct {
11201157
11211158type TimestampFlag = FlagBase[time.Time, TimestampConfig, timestampValue]
11221159
1160+ type UintArg = ArgumentBase[uint64, IntegerConfig, uintValue]
1161+
11231162type UintArgs = ArgumentsBase[uint64, IntegerConfig, uintValue]
11241163
11251164type UintFlag = FlagBase[uint, IntegerConfig, uintValue[uint]]
0 commit comments