mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
better directory vs file completion
This commit is contained in:
@@ -480,9 +480,9 @@ func makeInfoFromComps(compType string, comps []string, hasMore bool) sstore.Upd
|
|||||||
sort.Strings(comps)
|
sort.Strings(comps)
|
||||||
update := sstore.InfoUpdate{
|
update := sstore.InfoUpdate{
|
||||||
Info: &sstore.InfoMsgType{
|
Info: &sstore.InfoMsgType{
|
||||||
InfoTitle: fmt.Sprintf("%s completions", compType),
|
InfoTitle: fmt.Sprintf("%s completions", compType),
|
||||||
InfoStrings: comps,
|
InfoComps: comps,
|
||||||
InfoStringsMore: hasMore,
|
InfoCompsMore: hasMore,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return update
|
return update
|
||||||
@@ -508,6 +508,9 @@ func longestPrefix(root string, comps []string) string {
|
|||||||
if len(comps) == 1 {
|
if len(comps) == 1 {
|
||||||
comp := comps[0]
|
comp := comps[0]
|
||||||
if len(comp) >= len(root) && strings.HasPrefix(comp, root) {
|
if len(comp) >= len(root) && strings.HasPrefix(comp, root) {
|
||||||
|
if strings.HasSuffix(comp, "/") {
|
||||||
|
return comps[0]
|
||||||
|
}
|
||||||
return comps[0] + " "
|
return comps[0] + " "
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,12 +75,12 @@ func (LineUpdate) UpdateType() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type InfoMsgType struct {
|
type InfoMsgType struct {
|
||||||
InfoTitle string `json:"infotitle"`
|
InfoTitle string `json:"infotitle"`
|
||||||
InfoError string `json:"infoerror,omitempty"`
|
InfoError string `json:"infoerror,omitempty"`
|
||||||
InfoMsg string `json:"infomsg,omitempty"`
|
InfoMsg string `json:"infomsg,omitempty"`
|
||||||
InfoStrings []string `json:"infostrings"`
|
InfoComps []string `json:"infocomps"`
|
||||||
InfoStringsMore bool `json:"infostringsmore"`
|
InfoCompsMore bool `json:"infocompssmore"`
|
||||||
TimeoutMs int64 `json:"timeoutms,omitempty"`
|
TimeoutMs int64 `json:"timeoutms,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CmdLineType struct {
|
type CmdLineType struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user