1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-20 19:19:06 +08:00

Merge pull request #2990 from csasarak/janky_version

Alias 'ipfs --version' to 'ipfs version'
This commit is contained in:
Jeromy Johnson
2016-08-04 06:58:15 -07:00
committed by GitHub
2 changed files with 20 additions and 3 deletions

View File

@ -103,9 +103,13 @@ func main() {
}
// Handle `ipfs help'
if len(os.Args) == 2 && os.Args[1] == "help" {
printHelp(false, os.Stdout)
os.Exit(0)
if len(os.Args) == 2 {
if os.Args[1] == "help" {
printHelp(false, os.Stdout)
os.Exit(0)
} else if os.Args[1] == "--version" {
os.Args[1] = "version"
}
}
// parse the commandline into a command invocation

View File

@ -16,11 +16,24 @@ test_expect_success "ipfs version succeeds" '
ipfs version >version.txt
'
test_expect_success "ipfs --version success" '
ipfs --version ||
test_fsh ipfs --version
'
test_expect_success "ipfs version output looks good" '
egrep "^ipfs version [0-9]+\.[0-9]+\.[0-9]" version.txt >/dev/null ||
test_fsh cat version.txt
'
test_expect_success "ipfs versions matches ipfs --version" '
ipfs version > version.txt &&
ipfs --version > version2.txt &&
diff version2.txt version.txt ||
test_fsh ipfs --version
'
test_expect_success "ipfs version --all has all required fields" '
ipfs version --all > version_all.txt &&
grep "go-ipfs version" version_all.txt &&