Skip to content

Commit 773efae

Browse files
authored
Conditionally change the limit of F3 certs listed via CLI (#12669)
* When no range is given, default limit to 10 * Otherwise default to unlimited. This is better than the current default of always unlimited because: * there are a lot of certs, and * when range is given the chances are the user wants all of them. Addresses #12627 (comment)
1 parent 2da0b72 commit 773efae

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

cli/f3.go

+8-3
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,9 @@ An omitted <from> value is always interpreted as 0, and an omitted
135135
<to> value indicates the latest instance. If both are specified, <from>
136136
must never exceed <to>.
137137
138-
If no range is specified all certificates are listed, i.e. the range
139-
of '0..'.
138+
If no range is specified, the latest 10 certificates are listed, i.e.
139+
the range of '0..' with limit of 10. Otherwise, all certificates in
140+
the specified range are listed unless limit is explicitly specified.
140141
141142
Examples:
142143
* All certificates from newest to oldest:
@@ -181,6 +182,10 @@ Examples:
181182
fromTo := cctx.Args().First()
182183
if fromTo == "" {
183184
fromTo = "0.."
185+
if !cctx.IsSet(f3FlagInstanceLimit.Name) {
186+
// Default to limit of 10 if no explicit range and limit is given.
187+
limit = 10
188+
}
184189
}
185190
r, err := newRanger(fromTo, limit, reverse, func() (uint64, error) {
186191
latest, err := api.F3GetLatestCertificate(cctx.Context)
@@ -306,7 +311,7 @@ Examples:
306311
f3FlagInstanceLimit = &cli.IntFlag{
307312
Name: "limit",
308313
Usage: "The maximum number of instances. A value less than 0 indicates no limit.",
309-
DefaultText: "No limit",
314+
DefaultText: "10 when no range is specified. Otherwise, unlimited.",
310315
Value: -1,
311316
}
312317
f3FlagReverseOrder = &cli.BoolFlag{

documentation/en/cli-lotus.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -2774,8 +2774,9 @@ COMMANDS:
27742774
<to> value indicates the latest instance. If both are specified, <from>
27752775
must never exceed <to>.
27762776
2777-
If no range is specified all certificates are listed, i.e. the range
2778-
of '0..'.
2777+
If no range is specified, the latest 10 certificates are listed, i.e.
2778+
the range of '0..' with limit of 10. Otherwise, all certificates in
2779+
the specified range are listed unless limit is explicitly specified.
27792780
27802781
Examples:
27812782
* All certificates from newest to oldest:
@@ -2831,8 +2832,9 @@ NAME:
28312832
<to> value indicates the latest instance. If both are specified, <from>
28322833
must never exceed <to>.
28332834
2834-
If no range is specified all certificates are listed, i.e. the range
2835-
of '0..'.
2835+
If no range is specified, the latest 10 certificates are listed, i.e.
2836+
the range of '0..' with limit of 10. Otherwise, all certificates in
2837+
the specified range are listed unless limit is explicitly specified.
28362838
28372839
Examples:
28382840
* All certificates from newest to oldest:
@@ -2859,7 +2861,7 @@ USAGE:
28592861
28602862
OPTIONS:
28612863
--output value The output format. Supported formats: text, json (default: "text")
2862-
--limit value The maximum number of instances. A value less than 0 indicates no limit. (default: No limit)
2864+
--limit value The maximum number of instances. A value less than 0 indicates no limit. (default: 10 when no range is specified. Otherwise, unlimited.)
28632865
--reverse Reverses the default order of output. (default: false)
28642866
--help, -h show help
28652867
```

0 commit comments

Comments
 (0)