gitee.com/mirrors_u-root/u-root@v7.0.0+incompatible/pkg/complete/doc.go (about)

     1  // Copyright 2012-2018 the u-root Authors. All rights reserved
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Package complete implements a simple completion package
     6  // designed to be used in shells and other programs. It currently
     7  // offers completion functions to implement table-based and
     8  // file search path based completion. It also offers a multi
     9  // completion capability so that you can construct completions
    10  // from other completions.
    11  //
    12  // Goals:
    13  // small code base, so it can easily be embedded in firmware
    14  //
    15  // easily embedded in other programs, like the ip command
    16  //
    17  // friendly to mixed modes, i.e. if we say
    18  // ip l
    19  // and stdin is interactive, it would be nice if ip dropped into
    20  // a command line prompt and let you use completion to get the rest
    21  // of the line, instead of printing out a bnf
    22  //
    23  // The structs should be very light weight and hence cheap to build, use,
    24  // and throw away. They should NOT have lots of state.
    25  //
    26  // Rely on the fact that system calls and kernels are fast and cache file system
    27  // info so you should not. This means that we don't need to put huge effort into building in-memory
    28  // structs representing file system information. Just ask the kernel.
    29  //
    30  // Non-Goals:
    31  // be just like bash or zsh
    32  //
    33  // do extensive caching from the file system or environment. There was a time
    34  // (the 1970s as it happens) when extensive in-shell hash tables made sense.
    35  // Disco balls were also big. We don't need either.
    36  //
    37  // Use:
    38  // see the code, but basically, you can create completer and call a function
    39  // to read one word. The intent is that completers are so cheap that just
    40  // creating them on demand costs nothing. So far this seems to work.
    41  package complete