protocol

package
v0.0.0-...-92529da Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2016 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package protocol provides an implementation of the OpenRefactory protocol (server-side), which provides a standard mechanism for text editors to communicate with refactoring engines.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(writer io.Writer, aboutText string, args []string)

Types

type About

type About struct {
	// contains filtered or unexported fields
}

func (*About) Run

func (a *About) Run(state *State, input map[string]interface{}) (Reply, error)

func (*About) Validate

func (a *About) Validate(state *State, input map[string]interface{}) (bool, error)

type Command

type Command interface {
	Run(*State, map[string]interface{}) (Reply, error)
	Validate(*State, map[string]interface{}) (bool, error)
}

type List

type List struct {
	Fileselection []string               `json:"fileselection"`
	Textselection map[string]interface{} `json:"textselection"`
	Quality       string                 `json:"quality" chk:"in_testing|in_development|production"`
}

func (*List) Run

func (l *List) Run(state *State, input map[string]interface{}) (Reply, error)

func (*List) Validate

func (l *List) Validate(state *State, input map[string]interface{}) (bool, error)

type Open

type Open struct {
	Version float64 `json:"version"`
}

func (*Open) Run

func (o *Open) Run(state *State, input map[string]interface{}) (Reply, error)

func (*Open) Validate

func (o *Open) Validate(state *State, input map[string]interface{}) (bool, error)

basically useless until we implement versioning...

type Params

type Params struct {
	Transformation string                 `json:"transformation"`
	Fileselection  []string               `json:"fileselection"`
	Textselection  map[string]interface{} `json:"textselection"`
}

func (*Params) Run

func (p *Params) Run(state *State, input map[string]interface{}) (Reply, error)

func (*Params) Validate

func (p *Params) Validate(state *State, input map[string]interface{}) (bool, error)

type Put

type Put struct {
	Filename string `json:"filename"`
	Content  string `json:"content"`
}

func (*Put) Run

func (p *Put) Run(state *State, input map[string]interface{}) (Reply, error)

func (*Put) Validate

func (p *Put) Validate(state *State, input map[string]interface{}) (bool, error)

type Reply

type Reply struct {
	Params map[string]interface{}
}

func (Reply) String

func (r Reply) String() string

type Setdir

type Setdir struct {
	Mode string `json:"mode" chk:"local|web"`
}

func (*Setdir) Run

func (s *Setdir) Run(state *State, input map[string]interface{}) (Reply, error)

func (*Setdir) Validate

func (s *Setdir) Validate(state *State, input map[string]interface{}) (bool, error)

type State

type State struct {
	State      int
	Mode       string
	Dir        string
	Filesystem filesystem.FileSystem
}

type XRun

type XRun struct {
	Transformation string                 `json:"transformation"`
	Fileselection  []string               `json:"fileselection"`
	Textselection  map[string]interface{} `json:"textselection"`
	Arguments      []interface{}          `json:"arguments"`
	Limit          int                    `json:"limit"`
	Mode           string                 `json:"mode" chk:"text|patch"`
}

func (*XRun) Run

func (x *XRun) Run(state *State, input map[string]interface{}) (Reply, error)

TODO implement

func (*XRun) Validate

func (x *XRun) Validate(state *State, input map[string]interface{}) (bool, error)

TODO validate TextSelection, FileSelection, arguments

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL