Although our use of ANSI codes here is rather simple it is generally good practice to use terminfo in order to be portable to different terminal emulators. Vendor github.com/Nvveen/Gotty (actually my fork with a fix, see https://github.com/Nvveen/Gotty/pull/1) and use that to parse the terminfo files. Note that "\e]2K" (clear entire line) is not covered by terminfo. We can achieve the same end by first clearing from begining of line to cursor (el1="\e]1K") and then clearing from cursor to end of line (el="\e]k"). Test suite has been updated and forces (either directly or by setting $TERM to something highly unlikely to exist) the use of the non-terminfo fallbacks which retains the same output behaviour as previously. This is preferable even to relying on a well-known and relatively static terminfo (like vt102) since even that in principal might have different terminfo encodings. In case terminfo is not available at all for $TERM or doesn't expose the specific capabilities which we use then fall back to the previous manual escapes, with the exception that we avoid "\e]2K" as discussed above. Tested with a manual docker pull with rxvt-unicode ($TERM=rxvt-unicode), xterm ($TERM=xterm), mlterm ($TERM=mlterm) and aterm ($TERM=kterm). Signed-off-by: Ian Campbell <ian.campbell@docker.com> Upstream-commit: f02221a7941948017df68db8fd9a5de7f19453bf Component: engine
pkg/ is a collection of utility packages used by the Docker project without being specific to its internals.
Utility packages are kept separate from the docker core codebase to keep it as small and concise as possible. If some utilities grow larger and their APIs stabilize, they may be moved to their own repository under the Docker organization, to facilitate re-use by other projects. However that is not the priority.
The directory pkg is named after the same directory in the camlistore project. Since Brad is a core
Go maintainer, we thought it made sense to copy his methods for organizing Go code :) Thanks Brad!
Because utility packages are small and neatly separated from the rest of the codebase, they are a good place to start for aspiring maintainers and contributors. Get in touch if you want to help maintain them!