ipfs / kubo

An IPFS implementation in Go
https://docs.ipfs.tech/how-to/command-line-quick-start/
Other
16.16k stars 3.01k forks source link

Add `ipfs refs` options to `ipfs refs local` #3011

Open JesseWeinstein opened 8 years ago

JesseWeinstein commented 8 years ago

Type: feature Area: commands Priority: P0

It would be nice for ipfs refs local to take the same options as ipfs refs. You can jury-rig the effect by combining existing commands, but it'd be nicer if using the options just worked.

JesseWeinstein commented 8 years ago

I'm interested in working on this, but I'm not sure when I'll get to it.

ryco117 commented 7 years ago

Hi, I'm looking to contribute to ipfs and this seems like a fairly simple issue to start familiarizing myself with the codebase. It seems to me that the optionsMap check in commands/command.go GetOptions will disallow refs and its subcommand local from using the option names since it traverses the cmd path and adds the available options at each point to the map... Am I missing something or would "refs local" need to be renamed (something like) "refs-local" in order to use the same options/flags as regular "refs"

whyrusleeping commented 7 years ago

@ryco117 I think the best way to resolve this issue would be to simply duplicate some of the flags from ipfs refs into ipfs refs local. You don't want all of them (for example, -r and -u don't really make sense) but some of them would be good.

ryco117 commented 7 years ago

@whyrusleeping Hi, thanks for the response. Duplicating the args is exactly what I did, but refs local was rendered unusable since it triggered the return nil, fmt.Errorf("Option name '%s' used multiple times", name) in commands/command.go . This is because GetOptions "returns the options in the given path of commands" and doesn't seem to like the same args appearing multiple times in the cmd tree. Any clarification would be highly appreciated