github.com/oweisse/u-root@v0.0.0-20181109060735-d005ad25fef1/cmds/elvish/edit/completion/complete_redir.go (about) 1 package completion 2 3 import ( 4 "github.com/u-root/u-root/cmds/elvish/parse" 5 ) 6 7 type redirComplContext struct { 8 complContextCommon 9 } 10 11 func (*redirComplContext) name() string { return "redir" } 12 13 func findRedirComplContext(n parse.Node, ev pureEvaler) complContext { 14 if parse.IsSep(n) { 15 if parse.IsRedir(n.Parent()) { 16 return &redirComplContext{complContextCommon{ 17 "", quotingForEmptySeed, n.End(), n.End()}} 18 } 19 } 20 if primary, ok := n.(*parse.Primary); ok { 21 if compound, seed := primaryInSimpleCompound(primary, ev); compound != nil { 22 if parse.IsRedir(compound.Parent()) { 23 return &redirComplContext{complContextCommon{ 24 seed, primary.Type, compound.Begin(), compound.End()}} 25 } 26 } 27 } 28 return nil 29 } 30 31 func (ctx *redirComplContext) generate(env *complEnv, ch chan<- rawCandidate) error { 32 return complFilenameInner(ctx.seed, false, ch) 33 }