-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better error message on unrecognized command #1468
Conversation
} | ||
return sFinal | ||
} | ||
|
||
// if we have more arg values provided than argument definitions, | ||
// and the last arg definition is not variadic (or there are no definitions), return an error | ||
notVariadic := len(argDefs) == 0 || !argDefs[len(argDefs)-1].Variadic | ||
if notVariadic && len(inputs) > len(argDefs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if there are any legitimate cases where we would want to print this.. Or if this always means 'you spelled it wrong'.
9941dc5
to
fdd97db
Compare
Thanks for the feedback. I moved the code to a new file. I also renamed the searchUknownCmd func to suggestUnknownCmd. That name sounded a little better. |
"strings" | ||
|
||
cmds "github.com/ipfs/go-ipfs/commands" | ||
levenshtein "github.com/texttheater/golang-levenshtein/levenshtein" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will want to vendor. run
make vendor
from root.
in the event that godeps barfs at you with all sorts of requests, try go get
on all the needed packages.
people report that this works too:
godep restore
or even setting
export GOPATH=`pwd`/Godeps/_workspace:$GOPATH
as someone liable to type with one hand, i find this nice. I'm curious what other people think though and whether this is stuff to put in ipfs, or to leave up to shells? |
my golden rule: "what does git do?"
|
@sbruce if you want, one of us can probably handle the godep vendoring. Its quite the obnoxious process |
@whyrusleeping Thanks, but I think I finally figured out godeps. |
@sbruce almost there. need to
|
fbdf39a
to
d5496c1
Compare
Okay, make vendor should be fixed. I also squashed, and rebased with master. |
LGTM |
@sbruce i should've brought this up. could you write a test for it? if people start depending on this, i want to make sure it works. a sharness test would do. this should get you started:
#!/bin/sh
test_description="Test ipfs cli cmd suggest"
. lib/test-lib.sh
test_suggest() {
test_expect_success "test command fails" '
test_must_fail ipfs <cmd> >actual
'
test_expect_success "test one command is suggested" '
grep "<cmd1>" actual ||
fsh cat actual
'
test_expect_success "test command fails" '
test_must_fail ipfs <cmd> >actual
'
test_expect_success "test multiple commands are suggested" '
grep "<cmd1>" actual &&
grep "<cmd2>" actual ||
fsh cat actual
'
}
test_init_ipfs
test_suggest
test_launch_ipfs_daemon
test_suggest
test_kill_ipfs_daemon
test_done |
5c0d7f3
to
f4cf3b8
Compare
A sharness test has been added. Let me know if you think it isn't thorough enough. |
@sbruce sorry for the delay. I missed the test update. this LGTM. could you rebase on master? i'd be happy to include it in 0.3.6 if it's rebased today (else 0.3.7). |
and thanks! 👍 😄 |
Closes issue ipfs#1436 License: MIT Signed-off-by: Shaun Bruce <shaun.m.bruce@gmail.com>
f4cf3b8
to
c175700
Compare
I just rebased to master and pushed the branch. It should hopefully be ready to go. And, you're welcome. I'm looking forward to helping out more. |
thanks @sbruce ! 👍 |
Better error message on unrecognized command
License: MIT
Signed-off-by: Shaun Bruce shaun.m.bruce@gmail.com