diff --git a/cmd/ipfs/main.go b/cmd/ipfs/main.go index 94c54dab090..aec59637540 100644 --- a/cmd/ipfs/main.go +++ b/cmd/ipfs/main.go @@ -93,9 +93,13 @@ func mainRet() int { if os.Args[1] == "help" { if len(os.Args) > 2 { os.Args = append(os.Args[:1], os.Args[2:]...) - os.Args = append(os.Args, "-h") + // Handle `ipfs help --help` + // append `--help`,when the command is not `ipfs help --help` + if os.Args[1] != "--help" { + os.Args = append(os.Args, "--help") + } } else { - os.Args[1] = "-h" + os.Args[1] = "--help" } } } diff --git a/test/sharness/t0010-basic-commands.sh b/test/sharness/t0010-basic-commands.sh index 744b8b2e821..d5f89af33d9 100755 --- a/test/sharness/t0010-basic-commands.sh +++ b/test/sharness/t0010-basic-commands.sh @@ -41,26 +41,6 @@ test_expect_success "ipfs version --all has all required fields" ' grep "Golang version" version_all.txt ' -test_expect_success "ipfs help succeeds" ' - ipfs help >help.txt -' - -test_expect_success "ipfs help output looks good" ' - egrep -i "^Usage" help.txt >/dev/null && - egrep "ipfs " help.txt >/dev/null || - test_fsh cat help.txt -' - -test_expect_success "ipfs help --help succeeds" ' - ipfs help --help >help.txt -' - -test_expect_success "ipfs help --help output looks good" ' - egrep -i "^Usage" help.txt >/dev/null && - egrep "ipfs " help.txt >/dev/null || - test_fsh cat help.txt -' - test_expect_success "'ipfs commands' succeeds" ' ipfs commands >commands.txt ' @@ -71,6 +51,21 @@ test_expect_success "'ipfs commands' output looks good" ' grep "ipfs update" commands.txt ' +test_expect_success "All sub-commands accept help" ' + echo 0 > fail + while read -r cmd + do + ${cmd:0:4} help ${cmd:5} >/dev/null || + { echo "$cmd doesnt accept --help"; echo 1 > fail; } + echo stuff | $cmd --help >/dev/null || + { echo "$cmd doesnt accept --help when using stdin"; echo 1 > fail; } + done fail while read -r cmd diff --git a/test/sharness/t0060-daemon.sh b/test/sharness/t0060-daemon.sh index 3e7bb5cdde4..01fba5936bf 100755 --- a/test/sharness/t0060-daemon.sh +++ b/test/sharness/t0060-daemon.sh @@ -80,16 +80,6 @@ test_expect_success "ipfs help output looks good" ' test_fsh cat help.txt ' -test_expect_success "ipfs help --help succeeds" ' - ipfs help --help >help.txt -' - -test_expect_success "ipfs help --help output looks good" ' - egrep -i "^Usage" help.txt >/dev/null && - egrep "ipfs .* " help.txt >/dev/null || - test_fsh cat help.txt -' - # netcat (nc) is needed for the following test test_expect_success "nc is available" ' type nc >/dev/null diff --git a/test/sharness/t0100-name.sh b/test/sharness/t0100-name.sh index b33a46bd2b2..7a23fd1968d 100755 --- a/test/sharness/t0100-name.sh +++ b/test/sharness/t0100-name.sh @@ -158,10 +158,6 @@ test_expect_success "'ipfs name publish --help' succeeds" ' ipfs name publish --help ' -test_expect_success "'ipfs help name publish' succeeds" ' - ipfs help name publish -' - test_launch_ipfs_daemon test_expect_success "empty request to name publish doesn't panic and returns error" '