Versions in this module Expand all Collapse all v0 v0.2.3 Feb 27, 2015 v0.2.2 Feb 27, 2015 Changes in this version + const Bool + const ChanOpt + const EncLong + const EncShort + const Float + const Int + const Invalid + const JSON + const RecLong + const RecShort + const String + const Text + const Uint + const XML + var ErrIncorrectType = errors.New("The command returned a value with a different type than expected") + var ErrNoFormatter = ClientError("This command cannot be formatted to plain text") + var ErrNotCallable = ClientError("This command can't be called directly. Try one of its subcommands.") + var OptionEncodingType = StringOption(EncShort, EncLong, ...) + var OptionRecursivePath = BoolOption(RecShort, RecLong, "Add directory paths recursively") + var OptionStreamChannels = BoolOption(ChanOpt, "Stream channel output") + func ClientError(msg string) error + type Argument struct + Description string + Name string + Recursive bool + Required bool + SupportsStdin bool + Type ArgumentType + Variadic bool + func FileArg(name string, required, variadic bool, description string) Argument + func StringArg(name string, required, variadic bool, description string) Argument + func (a Argument) EnableRecursive() Argument + func (a Argument) EnableStdin() Argument + type ArgumentType int + const ArgFile + const ArgString + type ChannelMarshaler struct + Channel <-chan interface{} + Marshaler func(interface{}) (io.Reader, error) + func (cr *ChannelMarshaler) Read(p []byte) (int, error) + type Command struct + Arguments []Argument + Helptext HelpText + Marshalers map[EncodingType]Marshaler + Options []Option + PostRun Function + PreRun func(req Request) error + Run Function + Subcommands map[string]*Command + Type interface{} + func (c *Command) Call(req Request) Response + func (c *Command) CheckArguments(req Request) error + func (c *Command) Get(path []string) (*Command, error) + func (c *Command) GetOptions(path []string) (map[string]Option, error) + func (c *Command) Resolve(path []string) ([]*Command, error) + func (c *Command) Subcommand(id string) *Command + type Context struct + ConfigRoot string + ConstructNode func() (*core.IpfsNode, error) + Context context.Context + LoadConfig func(path string) (*config.Config, error) + Online bool + func (c *Context) GetConfig() (*config.Config, error) + func (c *Context) GetNode() (*core.IpfsNode, error) + func (c *Context) NodeWithoutConstructing() *core.IpfsNode + type EncodingType string + type Error struct + Code ErrorType + Message string + func (e Error) Error() string + type ErrorType uint + const ErrClient + const ErrNormal + type Function func(Request, Response) + type HelpText struct + Arguments string + LongDescription string + Options string + ShortDescription string + Subcommands string + Synopsis string + Tagline string + Usage string + type Marshaler func(Response) (io.Reader, error) + type MarshalerMap map[EncodingType]Marshaler + type Option interface + Description func() string + Names func() []string + Type func() reflect.Kind + func BoolOption(names ...string) Option + func FloatOption(names ...string) Option + func IntOption(names ...string) Option + func NewOption(kind reflect.Kind, names ...string) Option + func StringOption(names ...string) Option + func UintOption(names ...string) Option + type OptionValue struct + func (ov OptionValue) Bool() (value bool, found bool, err error) + func (ov OptionValue) Definition() Option + func (ov OptionValue) Float() (value float64, found bool, err error) + func (ov OptionValue) Found() bool + func (ov OptionValue) Int() (value int, found bool, err error) + func (ov OptionValue) String() (value string, found bool, err error) + func (ov OptionValue) Uint() (value uint, found bool, err error) + type Request interface + Arguments func() []string + Command func() *Command + Context func() *Context + ConvertOptions func() error + Files func() files.File + Option func(name string) *OptionValue + Options func() optMap + Path func() []string + SetArguments func([]string) + SetContext func(Context) + SetFiles func(files.File) + SetOption func(name string, val interface{}) + SetOptions func(opts map[string]interface{}) error + Stdin func() io.Reader + Values func() map[string]interface{} + func NewEmptyRequest() (Request, error) + func NewRequest(path []string, opts optMap, args []string, file files.File, cmd *Command, ...) (Request, error) + type Response interface + Error func() *Error + Length func() uint64 + Marshal func() (io.Reader, error) + Output func() interface{} + Reader func() (io.Reader, error) + Request func() Request + SetError func(err error, code ErrorType) + SetLength func(uint64) + SetOutput func(interface{}) + Stderr func() io.Writer + Stdout func() io.Writer + func NewResponse(req Request) Response