Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

General way to invoke all available commands with all options #92

@jbenet

Description

@jbenet

It is very useful to have very clean go interfaces with nice typing. But right now the api is simply incomplete. We should have some fallback methods to be able to use any command and any option available, at the cost of complexity for the user.

For example, i want to use the trickledag layout, but i cannot call it because it hasn't been added to the nicer exported add commands. I don't see a way of doing it, and so instead i shelled out (gross). (yes, this should really just be contributed as we go, and we should source contributions this way, but the amount of time it takes to contribute this and bikeshed the interfaces is unreasonable for quick hacks).

I think that even as we work to a complete well-typed api, something like this should be possible:

s, err := shell.AddWithAnyOpts(r, map[string]interface{}{
  "trickle": true,
  "chunker": "rabin-512-1024-2048",
})

and potentially something like this:

func (s *shell) Cmd(cmd string, args []interface{}, opts map[string]interface{})

shell.Cmd("add", []interface{r}, map[string]interface{}{
  "trickle": true,
  "chunker": "rabin-512-1024-2048",
})

this would make it at worst case usable, instead of forcing us to shell out, or use js-api instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions