This is a strange one, but I'm reporting it anyway.
ipfs help --help
Error: Unknown Command "help"
This seems to be the only command that doesn't support the --help flag.
While it probably wouldn't do anything more than the bare help subcommand itself, I found the error odd.
Ah... Looks like help was a leftover. It's not actually a command.
So you mean that we should delete ipfs help?
Unfortunately, we actually use it. I said "leftover" because it looks like it may be a leftover from before we had a commands library (not sure, it may not have been).
However, we should probably make it behave better. The solution here is probably to just remove the length check. That is, convert "help" to "--help", even if there are other flags. Thoughts?
Would it be better to formalize it as a command? With this kind of alias mapping:
ipfs help add -> ipfs add --help?
Edit: Stebalien was quicker 👏
Maybe? I'm not sure it's worth the effort (that would probably require deep changes to the commands library).
Unfortunately, we actually use it. I said "leftover" because it looks like it may be a leftover from before we had a commands library (not sure, it may not have been).
Sorry @Stebalien , i have misunderstand your reply before.
Would it be better to formalize it as a command? With this kind of alias mapping:
ipfs help add->ipfs add --help?
Agree,I think thatipfs <sub-command> --help maybe better,of course it will casue breanking?
If you decide to do it,I am willing to do this work.Thx
For now, we could probably use the same hack, but append to args.
i.e. something similar to
if helpcmd {
args = append(args[:2], args[3:]...) //remove "help"
args = append(args, "--help")
in phase: ipfs help add -> ipfs add -> ipfs add --help
Right now, we alias ipfs help to ipfs -h but ipfs --help works the same, so it shouldn't break that case either.
It seems to work with other flags too.
ipfs add -w --help is the same as ipfs add --help alone.
And keep it in mind as the cmdslib evolves. See if it's necessary to formalize it as a cmd command.
Not sure if stacking hacks on hacks is a good idea, but for this specific command it seems harmless and unlikely to ever require change.
I guess the only thing we'd need to do is create some kind of stub cmd that is there only to hold the documentation for help and propagate it in ipfs commands.
Thoughts?
Agree!@djdv , I am working for it right now.Thx a lot for very nice advices!!!
Fixed.