cli: trim basic help, drop invented flag, parallelize by default
Surface area, not the machinery, was the problem: 16 flags crowded the bare --help. Re-tag so basic shows only the 10 outcome-changing flags; every other flag still works behind --help=<group>. - cut --bt-metadata-timeout, an invented flag with no real counterpart. Keep its 60s magnet-metadata stall as a fixed internal default (bt.go), not a user knob. - fix the parallelism footgun: a bare `got URL` used min(split,x)=1 connection. When -x is unset, let --split drive per-host connections (capped at 16), so `got URL` gets 5 and `-s16` gets 16. An explicit -x is honored verbatim, including -x1. Locked by TestHTTPConnDefault. - -s is the per-download speed dial now, so it moves to basic; -x (a per-server cap) moves to the http group. -j help says "files at once, not connections within one file".
This commit is contained in:
@@ -22,7 +22,7 @@ func TestParseArgs(t *testing.T) {
|
||||
{"permute flag after uri", []string{"u", "--split=8"}, Run, map[string]string{"split": "8"}, []string{"u"}},
|
||||
{"permute interleaved", []string{"a", "-c", "b", "--quiet"}, Run, map[string]string{"continue": "true", "quiet": "true"}, []string{"a", "b"}},
|
||||
{"dash dash terminator", []string{"--split=8", "--", "--not-a-flag", "u"}, Run, map[string]string{"split": "8"}, []string{"--not-a-flag", "u"}},
|
||||
{"bt metadata timeout", []string{"--bt-metadata-timeout=120", "magnet:x"}, Run, map[string]string{"bt-metadata-timeout": "120"}, []string{"magnet:x"}},
|
||||
{"long int + magnet uri", []string{"--bt-stop-timeout=120", "magnet:x"}, Run, map[string]string{"bt-stop-timeout": "120"}, []string{"magnet:x"}},
|
||||
{"help", []string{"--help"}, ShowHelp, nil, nil},
|
||||
{"help short", []string{"-h"}, ShowHelp, nil, nil},
|
||||
{"version", []string{"-v"}, ShowVersion, nil, nil},
|
||||
@@ -68,21 +68,6 @@ func TestParseArgsErrors(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// got bounds the magnet metadata fetch by default rather than waiting forever;
|
||||
// guard the default value and its zero floor.
|
||||
func TestBTMetadataTimeoutDefault(t *testing.T) {
|
||||
o, ok := byLong["bt-metadata-timeout"]
|
||||
if !ok {
|
||||
t.Fatal("bt-metadata-timeout option is missing")
|
||||
}
|
||||
if o.Default != "60" {
|
||||
t.Errorf("bt-metadata-timeout default = %q, want %q", o.Default, "60")
|
||||
}
|
||||
if o.Min != 0 {
|
||||
t.Errorf("bt-metadata-timeout Min = %d, want 0 (reject negatives, allow 0=off)", o.Min)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseSize(t *testing.T) {
|
||||
tests := []struct {
|
||||
in string
|
||||
|
||||
Reference in New Issue
Block a user