From b59e271047fb6e1a5bfcc5b02441907aa11d9882 Mon Sep 17 00:00:00 2001 From: Chris Sasarak Date: Mon, 25 Jul 2016 21:49:33 -0400 Subject: [PATCH 1/2] Alias 'ipfs --version' to 'ipfs version' License: MIT Signed-off-by: Chris Sasarak --- cmd/ipfs/main.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/ipfs/main.go b/cmd/ipfs/main.go index 817d72472ac..f5b03567843 100644 --- a/cmd/ipfs/main.go +++ b/cmd/ipfs/main.go @@ -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 From 5e9cbd740d199ef94d24143d0f06e4f7f9de7f7d Mon Sep 17 00:00:00 2001 From: Chris Sasarak Date: Tue, 26 Jul 2016 19:29:46 -0400 Subject: [PATCH 2/2] Added tests for ipfs --version. 1. Test that ipfs --version has a 0 exit status 2. Check the ipfs --version output matches ipfs version License: MIT Signed-off-by: Chris Sasarak --- test/sharness/t0010-basic-commands.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/sharness/t0010-basic-commands.sh b/test/sharness/t0010-basic-commands.sh index 4b05c99b67c..a4d5614351f 100755 --- a/test/sharness/t0010-basic-commands.sh +++ b/test/sharness/t0010-basic-commands.sh @@ -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 &&