comp

package
v0.0.0-...-d07068c Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

scripthaus completion

Index

Constants

View Source
const (
	// local to simplecomp
	CGTypeCommand  = "command"
	CGTypeFile     = "file"
	CGTypeDir      = "directory"
	CGTypeVariable = "variable"

	// implemented in cmdrunner
	CGTypeMeta        = "metacmd"
	CGTypeCommandMeta = "command+meta"

	CGTypeRemote         = "remote"
	CGTypeRemoteInstance = "remoteinstance"
	CGTypeGlobalCmd      = "globalcmd"
)
View Source
const (
	QuoteTypeLiteral = ""
	QuoteTypeDQ      = "\""
	QuoteTypeANSI    = "$'"
	QuoteTypeSQ      = "'"
)
View Source
const MaxCompQuoteLen = 5000

Variables

View Source
var SimpleCompGenFns map[string]SimpleCompGenFnType

Functions

func RegisterSimpleCompFn

func RegisterSimpleCompFn(compType string, fn SimpleCompGenFnType)

func SortCompReturnEntries

func SortCompReturnEntries(c *CompReturn)

Types

type CompContext

type CompContext struct {
	RemotePtr  *sstore.RemotePtrType
	Cwd        string
	ForDisplay bool
}

type CompEntry

type CompEntry struct {
	Word      string
	IsMetaCmd bool
}

directories will have a trailing "/"

type CompPoint

type CompPoint struct {
	StmtStr     string
	Words       []ParsedWord
	CompWord    int
	CompWordPos int
	Prefix      string
	Suffix      string
}

func ParseCompPoint

func ParseCompPoint(cmdStr utilfn.StrWithPos) *CompPoint

func (*CompPoint) FullyExtend

func (p *CompPoint) FullyExtend(crtn *CompReturn) utilfn.StrWithPos

type CompReturn

type CompReturn struct {
	CompType string
	Entries  []CompEntry
	HasMore  bool
}

func CombineCompReturn

func CombineCompReturn(compType string, c1 *CompReturn, c2 *CompReturn) *CompReturn

func DoCompGen

func DoCompGen(ctx context.Context, cmdStr utilfn.StrWithPos, compCtx CompContext) (*CompReturn, *utilfn.StrWithPos, error)

func DoCompGenOld

func DoCompGenOld(ctx context.Context, sp utilfn.StrWithPos, compCtx CompContext) (*CompReturn, *utilfn.StrWithPos, error)

func DoSimpleComp

func DoSimpleComp(ctx context.Context, compType string, prefix string, compCtx CompContext, args []interface{}) (*CompReturn, error)

func (*CompReturn) GetCompDisplayStrs

func (c *CompReturn) GetCompDisplayStrs() []string

func (*CompReturn) GetCompStrs

func (c *CompReturn) GetCompStrs() []string

type ParsedWord

type ParsedWord struct {
	Offset      int
	Word        *syntax.Word
	PartialWord string
	Prefix      string
}

type SimpleCompGenFnType

type SimpleCompGenFnType = func(ctx context.Context, prefix string, compCtx CompContext, args []interface{}) (*CompReturn, error)

Jump to

Keyboard shortcuts

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