Documentation ¶
Overview ¶
Package complete implements file name completion.
This is a port of Plan 9's libcomplete to Go.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Completion ¶
type Completion struct { // Advance reports whether the file name prefix can be extended // without changing the set of files that match. Advance bool // Complete reports whether the extended file name uniquely // identifies a file (i.e. NMatch == 1). Complete bool // String holds the extension of the file name prefix. // // If Advance is false, String is an empty string. Otherwise, // String will be set to the extension; that is, the value of // String may be appended to the file name prefix by the caller // to extend the embryonic file name unambiguously. // // If Complete is true, String will be suffixed with a blank, // or a path separator, depending on whether the resulting file // name identifies a plain file or a directory. String string // NMatch specifies the number of files that matched. NMatch int // Filename holds the matching filenames. If there is no match // (NMatch == 0), it holds the full set of files in the directory. // If the file named is a directory, a slash character will be // appended to it. Filename []string }
Completion represents the result of file completion.
func Complete ¶
func Complete(dir, s string) (*Completion, error)
Complete implements file name completion. Given a directory dir and a file name prefix s, it returns an analysis of the file names in that directory that begin with the string s.
Click to show internal directories.
Click to hide internal directories.