edwood: github.com/rjkroege/edwood/internal/complete Index | Files

package complete

import "github.com/rjkroege/edwood/internal/complete"

Package complete implements file name completion.

This is a port of Plan 9's libcomplete to Go.


Package Files


type Completion Uses

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 Uses

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.

Package complete imports 5 packages (graph) and is imported by 1 packages. Updated 2019-05-05. Refresh now. Tools for package owners.