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