mirror of
https://github.com/peco/peco.git
synced 2026-09-10 07:16:29 -04:00
reinstate --initial-filter
This commit is contained in:
parent
8c400c1d81
commit
e1e64b83dc
|
|
@ -68,7 +68,8 @@ type Peco struct {
|
|||
filters FilterSet
|
||||
keymap Keymap
|
||||
enableSep bool // Enable parsing on separators
|
||||
initialQuery string // True if --query is specified
|
||||
initialFilter string // populated if --initial-filter is specified
|
||||
initialQuery string // populated if --query is specified
|
||||
inputseq Inputseq // current key sequence (just the names)
|
||||
layoutType string
|
||||
location Location
|
||||
|
|
|
|||
12
peco.go
12
peco.go
|
|
@ -446,6 +446,18 @@ func (p *Peco) ApplyConfig(opts CLIOptions) error {
|
|||
return errors.Wrap(err, "failed to populate styles")
|
||||
}
|
||||
|
||||
if len(opts.OptInitialFilter) <= 0 && len(opts.OptInitialMatcher) > 0 {
|
||||
p.initialFilter = opts.OptInitialMatcher
|
||||
} else if len(opts.OptInitialFilter) > 0 {
|
||||
p.initialFilter = opts.OptInitialFilter
|
||||
}
|
||||
|
||||
if v := p.initialFilter; v != "" {
|
||||
if err := p.filters.SetCurrentByName(v); err != nil {
|
||||
return errors.Wrap(err, "failed to set filter")
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue