mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-06 16:58:11 +08:00
commands: Added Command#Get
This commit is contained in:
parent
c054fb3655
commit
d2176c05eb
@ -91,6 +91,14 @@ func (c *Command) Resolve(path []string) ([]*Command, error) {
|
||||
return cmds, nil
|
||||
}
|
||||
|
||||
func (c *Command) Get(path []string) (*Command, error) {
|
||||
cmds, err := c.Resolve(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return cmds[len(cmds) - 1], nil
|
||||
}
|
||||
|
||||
// GetOptions gets the options in the given path of commands
|
||||
func (c *Command) GetOptions(path []string) (map[string]Option, error) {
|
||||
options := make([]Option, len(c.Options))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user