commit 2ea0289e9f50a0ce83c562fbf9deca76cb3116cc Author: Rob Muhlestein Date: Wed Feb 9 02:29:05 2022 -0500 Rebase diff --git a/.FreeCAD/.FreeCAD b/.FreeCAD/.FreeCAD new file mode 120000 index 0000000..af30071 --- /dev/null +++ b/.FreeCAD/.FreeCAD @@ -0,0 +1 @@ +/Users/rmuhlest/repos/github.com/rwxrob/dot/.FreeCAD \ No newline at end of file diff --git a/.FreeCAD/cookies b/.FreeCAD/cookies new file mode 100644 index 0000000..e69de29 diff --git a/.FreeCAD/system.cfg b/.FreeCAD/system.cfg new file mode 100644 index 0000000..687a67d --- /dev/null +++ b/.FreeCAD/system.cfg @@ -0,0 +1,22 @@ + + + + + + Path/Help/index.html + Path + PathWorkbench.py + + + Spreadsheet/Help/index.html + Spreadsheet + SpreadsheetWorkbench.py + + + Image/Help/index.html + Image + ImageWorkbench.py + + + + diff --git a/.FreeCAD/user.cfg b/.FreeCAD/user.cfg new file mode 100644 index 0000000..b3c56c4 --- /dev/null +++ b/.FreeCAD/user.cfg @@ -0,0 +1,472 @@ + + + + + + + + + + /home/rwxrob/Downloads + PartDesignWorkbench + + + + PartWorkbench + + + + + + + + /home/rwxrob/.FreeCAD/Macro + + + + + FullScript.FCScript + + + + + + + + + + + + + + + + + + + + StartWorkbench + + + + + + + + + + + + + + + + + + + + + + + + + + IfcProduct + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AP214IS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10.00 mm + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Std_SelForward + Std_SelBack + Gui::BlenderNavigationStyle + + + + + + + + + + + + + + + + + + + + + + + + + + + + Trimetric + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + %Y%m%d-%H%M%S + + + + http://en.wikipedia.org/wiki/All_rights_reserved + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Sans Serif + + + + ProDark.qss + + + /home/rwxrob/Downloads/model.dae + + + + + + + + + + BaseApp.Preferences.Document + (2240,1282,3039,1881) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..138d0e4 --- /dev/null +++ b/.bashrc @@ -0,0 +1,346 @@ +#!/usr/bin/bash +# shellcheck disable=SC1090 + +case $- in +*i*) ;; # interactive +*) return ;; +esac + +# ------------------------- distro detection ------------------------- + +export DISTRO +[[ $(uname -r) =~ Microsoft ]] && DISTRO=WSL2 #TODO distinguish WSL1 +#TODO add the rest + +# ---------------------- local utility functions --------------------- + +_have() { type "$1" &>/dev/null; } +_source_if() { [[ -r "$1" ]] && source "$1"; } + +# ----------------------- environment variables ---------------------- +# (also see envx) + +export USER="$(whoami)" +export GITUSER="$USER" +export REPOS="$HOME/Repos" +export GHREPOS="$REPOS/github.com/$GITUSER" +export DOTFILES="$GHREPOS/dot" +export SCRIPTS="$DOTFILES/scripts" +export SNIPPETS="$DOTFILES/snippets" +export HELP_BROWSER=lynx +export DESKTOP="$HOME/Desktop" +export DOCUMENTS="$HOME/Documents" +export DOWNLOADS="$HOME/Downloads" +export TEMPLATES="$HOME/Templates" +export PUBLIC="$HOME/Public" +export PRIVATE="$HOME/Private" +export PICTURES="$HOME/Pictures" +export MUSIC="$HOME/Music" +export VIDEOS="$HOME/Videos" +export PDFS="$DOCUMENTS/PDFS" +export VIRTUALMACHINES="$HOME/VirtualMachines" +export WORKSPACES="$HOME/Workspaces" # container home dirs for mounting +export ZETDIR="$GHREPOS/zet" +export ZETTELCASTS="$VIDEOS/ZettelCasts" +export CLIP_DIR="$VIDEOS/Clips" +export CLIP_DATA="$GHREPOS/cmd-clip/data" +export CLIP_VOLUME=0 +export CLIP_SCREEN=0 +export TERM=xterm-256color +export HRULEWIDTH=73 +export EDITOR=vi +export VISUAL=vi +export EDITOR_PREFIX=vi +export GOPRIVATE="github.com/$GITUSER/*,gitlab.com/$GITUSER/*" +export GOPATH="$HOME/.local/share/go" +export GOBIN="$HOME/.local/bin" +export GOPROXY=direct +export CGO_ENABLED=0 +export PYTHONDONTWRITEBYTECODE=2 # fucking shit-for-brains var name +export LC_COLLATE=C +export CFLAGS="-Wall -Wextra -Werror -O0 -g -fsanitize=address -fno-omit-frame-pointer -finstrument-functions" +export LESS_TERMCAP_mb="" # magenta +export LESS_TERMCAP_md="" # yellow +export LESS_TERMCAP_me="" # "0m" +export LESS_TERMCAP_se="" # "0m" +export LESS_TERMCAP_so="" # blue +export LESS_TERMCAP_ue="" # "0m" +export LESS_TERMCAP_us="" # underline +export ANSIBLE_INVENTORY="$HOME/.config/ansible/ansible_hosts" + +[[ -d /.vim/spell ]] && export VIMSPELL=("$HOME/.vim/spell/*.add") + +# -------------------------------- gpg ------------------------------- + +#export GPG_TTY=$(tty) + +# ------------------------------- pager ------------------------------ + +if [[ -x /usr/bin/lesspipe ]]; then + export LESSOPEN="| /usr/bin/lesspipe %s"; + export LESSCLOSE="/usr/bin/lesspipe %s %s"; +fi + +# ----------------------------- dircolors ---------------------------- + +if _have dircolors; then + if [[ -r "$HOME/.dircolors" ]]; then + eval "$(dircolors -b "$HOME/.dircolors")" + else + eval "$(dircolors -b)" + fi +fi + +# ------------------------------- path ------------------------------- + +pathappend() { + declare arg + for arg in "$@"; do + test -d "$arg" || continue + PATH=${PATH//":$arg:"/:} + PATH=${PATH/#"$arg:"/} + PATH=${PATH/%":$arg"/} + export PATH="${PATH:+"$PATH:"}$arg" + done +} && export pathappend + +pathprepend() { + for arg in "$@"; do + test -d "$arg" || continue + PATH=${PATH//:"$arg:"/:} + PATH=${PATH/#"$arg:"/} + PATH=${PATH/%":$arg"/} + export PATH="$arg${PATH:+":${PATH}"}" + done +} && export pathprepend + +# remember last arg will be first in path +pathprepend \ + /usr/local/go/bin \ + "$HOME/.local/bin" \ + "$GHREPOS/cmd-"* \ + "$SCRIPTS" + +pathappend \ + /usr/local/opt/coreutils/libexec/gnubin \ + '/mnt/c/Program Files/Oracle/VirtualBox' \ + '/mnt/c/Windows' \ + '/mnt/c/Program Files (x86)/VMware/VMware Workstation' \ + /mingw64/bin \ + /usr/local/bin \ + /usr/local/sbin \ + /usr/local/games \ + /usr/games \ + /usr/sbin \ + /usr/bin \ + /snap/bin \ + /sbin \ + /bin + +# ------------------------------ cdpath ------------------------------ + +export CDPATH=".:$GHREPOS:$DOT:$REPOS:/media/$USER:$HOME" + +# ------------------------ bash shell options ------------------------ + +shopt -s checkwinsize +shopt -s expand_aliases +shopt -s globstar +shopt -s dotglob +shopt -s extglob + +#shopt -s nullglob # bug kills completion for some +#set -o noclobber + +# ------------------------------ history ----------------------------- + +export HISTCONTROL=ignoreboth +export HISTSIZE=5000 +export HISTFILESIZE=10000 + +set -o vi +shopt -s histappend + +# --------------------------- smart prompt --------------------------- +# (keeping in bashrc for portability) + +PROMPT_LONG=20 +PROMPT_MAX=95 +PROMPT_AT=@ + +__ps1() { + local P='$' dir="${PWD##*/}" B countme short long double\ + r='\[\e[31m\]' g='\[\e[30m\]' h='\[\e[34m\]' \ + u='\[\e[33m\]' p='\[\e[34m\]' w='\[\e[35m\]' \ + b='\[\e[36m\]' x='\[\e[0m\]' + + [[ $EUID == 0 ]] && P='#' && u=$r && p=$u # root + [[ $PWD = / ]] && dir=/ + [[ $PWD = "$HOME" ]] && dir='~' + + B=$(git branch --show-current 2>/dev/null) + [[ $dir = "$B" ]] && B=. + countme="$USER$PROMPT_AT$(hostname):$dir($B)\$ " + + [[ $B = master || $B = main ]] && b="$r" + [[ -n "$B" ]] && B="$g($b$B$g)" + + short="$u\u$g$PROMPT_AT$h\h$g:$w$dir$B$p$P$x " + #long="╔ $u\u$g$PROMPT_AT$h\h$g:$w$dir$B\n╚ $p$P$x " + long="${g}╔ $u\u$g$PROMPT_AT$h\h$g:$w$dir$B\n${g}╚ $p$P$x " + double="$g╔ $u\u$g$PROMPT_AT$h\h$g:$w$dir\n$g║ $B\n$g╚ $p$P$x " + + if (( ${#countme} > PROMPT_MAX )); then + PS1="$double" + elif (( ${#countme} > PROMPT_LONG )); then + PS1="$long" + else + PS1="$short" + fi +} + +PROMPT_COMMAND="__ps1" + +# ----------------------------- keyboard ----------------------------- + +_have setxkbmap && test -n "$DISPLAY" && \ + setxkbmap -option caps:escape &>/dev/null + +# ------------------------------ aliases ----------------------------- +# (use exec scripts instead, which work from vim and subprocs) + +unalias -a +alias '?'=duck +alias '??'=google +alias '???'=bing +alias dot='cd $DOTFILES' +alias scripts='cd $SCRIPTS' +alias snippets='cd $SNIPPETS' +alias ls='ls -h --color=auto' +alias free='free -h' +alias df='df -h' +alias chmox='chmod +x' +alias sshh='sshpass -f $HOME/.sshpass ssh ' +alias temp='cd $(mktemp -d)' +alias view='vi -R' # which is usually linked to vim +alias c='printf "\e[H\e[2J"' +alias clear='printf "\e[H\e[2J"' +alias coin="clip '(yes|no)'" +alias grep="grep -P" +alias minidockenv=". <(minikube docker-env)" +alias top=bashtop +alias iam=live + +_have vim && alias vi=vim + +# ----------------------------- functions ---------------------------- + +envx() { + local envfile="${1:-"$HOME/.env"}" + [[ ! -e "$envfile" ]] && echo "$envfile not found" && return 1 + while IFS= read -r line; do + name=${line%%=*} + value=${line#*=} + [[ -z "${name}" || $name =~ ^# ]] && continue + export "$name"="$value" + done < "$envfile" +} && export -f envx + +[[ -e "$HOME/.env" ]] && envx "$HOME/.env" + +new-from() { + local template="$1" + local name="$2" + ! _have gh && echo "gh command not found" && return 1 + [[ -z "$name" ]] && echo "usage: $0 " && return 1 + [[ -z "$GHREPOS" ]] && echo "GHREPOS not set" && return 1 + [[ ! -d "$GHREPOS" ]] && echo "Not found: $GHREPOS" && return 1 + cd "$GHREPOS" || return 1 + [[ -e "$name" ]] && echo "exists: $name" && return 1 + gh repo create -p "$template" "$name" + cd "$name" || return 1 +} + +new-cmdbox() { new-from rwxrob/template-cmdbox "cmdbox-$1"; } +new-cmd() { new-from rwxrob/template-bash-command "cmd-$1"; } +cdz () { cd $(zet get "$@"); } + +export -f new-from new-cmdbox new-cmd + +clone() { + local repo="$1" user + local repo="${repo#https://github.com/}" + local repo="${repo#git@github.com:}" + if [[ $repo =~ / ]]; then + user="${repo%%/*}" + else + user="$GITUSER" + [[ -z "$user" ]] && user="$USER" + fi + local name="${repo##*/}" + local userd="$REPOS/github.com/$user" + local path="$userd/$name" + [[ -d "$path" ]] && cd "$path" && return + mkdir -p "$userd" + cd "$userd" + echo gh repo clone "$user/$name" -- --recurse-submodule + gh repo clone "$user/$name" -- --recurse-submodule + cd "$name" +} && export -f clone + +# ------------- source external dependencies / completion ------------ + +owncomp=( + pdf md zet yt gl auth pomo config live iam sshkey ws x clip + ./build build b ./k8sapp k8sapp ./setup ./cmd run ./run +) + +for i in "${owncomp[@]}"; do complete -C "$i" "$i"; done + +_have gh && . <(gh completion -s bash) +_have pandoc && . <(pandoc --bash-completion) +_have kubectl && . <(kubectl completion bash 2>/dev/null) +_have spotify && . <(spotify completion bash 2>/dev/null) +#_have clusterctl && . <(clusterctl completion bash) +_have k && complete -o default -F __start_kubectl k +_have kind && . <(kind completion bash) +_have kompose && . <(kompose completion bash) +_have yq && . <(yq shell-completion bash) +_have helm && . <(helm completion bash) +_have minikube && . <(minikube completion bash) +_have conftest && . <(conftest completion bash) +_have mk && complete -o default -F __start_minikube mk +_have podman && _source_if "$HOME/.local/share/podman/completion" # d +_have docker && _source_if "$HOME/.local/share/docker/completion" # d +_have docker-compose && complete -F _docker_compose dc # dc + +# -------------------- personalized configuration -------------------- +_source_if "$HOME/.bash_personal" +_source_if "$HOME/.bash_private" +_source_if "$HOME/.bash_work" + +complete -C /usr/bin/terraform terraform +complete -C /usr/bin/terraform tf + +# only use this if you really want libvirt (virtualbox does not need) +# vagrant(){ +# docker run -it --rm \ +# -e LIBVIRT_DEFAULT_URI \ +# -v /var/run/libvirt/:/var/run/libvirt/ \ +# -v ~/.vagrant.d:/.vagrant.d \ +# -v $(realpath "${PWD}"):${PWD} \ +# -w $(realpath "${PWD}") \ +# --network host \ +# vagrantlibvirt/vagrant-libvirt:latest \ +# vagrant $@ +# } && export -f vagrant + +if _have vagrant; then +export VAGRANT_EXPERIMENTAL="disks" +# >>>> Vagrant command completion (start) +. /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/contrib/bash/completion.sh +# <<<< Vagrant command completion (end) + complete -F _vagrant v +fi +export DISPLAY=:0.0 #GWSL +export PULSE_SERVER=tcp:localhost #GWSL diff --git a/.dircolors b/.dircolors new file mode 100644 index 0000000..79c8e85 --- /dev/null +++ b/.dircolors @@ -0,0 +1,307 @@ +COLOR tty +TERM ansi +TERM color_xterm +TERM color-xterm +TERM con132x25 +TERM con132x30 +TERM con132x43 +TERM con132x60 +TERM con80x25 +TERM con80x28 +TERM con80x30 +TERM con80x43 +TERM con80x50 +TERM con80x60 +TERM cons25 +TERM console +TERM cygwin +TERM dtterm +TERM Eterm +TERM eterm-color +TERM fbterm +TERM gnome +TERM gnome-256color +TERM jfbterm +TERM konsole +TERM konsole-256color +TERM kterm +TERM linux +TERM linux-c +TERM mach-color +TERM mlterm +TERM nxterm +TERM putty +TERM putty-256color +TERM rxvt +TERM rxvt-256color +TERM rxvt-cygwin +TERM rxvt-cygwin-native +TERM rxvt-unicode +TERM rxvt-unicode256 +TERM rxvt-unicode-256color +TERM screen +TERM screen-16color +TERM screen-16color-bce +TERM screen-16color-s +TERM screen-16color-bce-s +TERM screen-256color +TERM screen-256color-bce +TERM screen-256color-s +TERM screen-256color-bce-s +TERM screen-bce +TERM screen-w +TERM screen.linux +TERM screen.xterm-new +TERM st +TERM st-meta +TERM st-256color +TERM st-meta-256color +TERM vt100 +TERM xterm +TERM xterm-new +TERM xterm-16color +TERM xterm-256color +TERM xterm-88color +TERM xterm-color +TERM xterm-debian +TERM xterm-termite +EIGHTBIT 1 +NORMAL 00 +FILE 00 +DIR 34 +OTHER_WRITABLE 34;40 +LINK 35 +FIFO 30;44 +SOCK 35;44 +DOOR 35;44 # Solaris 2.5 and later +BLK 33;44 +CHR 37;44 +ORPHAN 05;37;41 +MISSING 05;37;41 + +EXEC 31 # Unix +.cmd 31 # Win +.exe 31 # Win +.com 31 # Win +.bat 31 # Win +.reg 31 # Win +.app 31 # OSX +.txt 32 +.org 32 +.md 32 +.mkd 32 +.h 32 +.c 32 +.C 32 +.cc 32 +.cpp 32 +.cxx 32 +.objc 32 +.sh 32 +.bash 32 +.csh 32 +.zsh 32 +.el 32 +.vim 32 +.java 32 +.pl 32 +.pm 32 +.py 32 +.rb 32 +.hs 32 +.php 32 +.htm 32 +.html 32 +.shtml 32 +.erb 32 +.haml 32 +.xml 32 +.rdf 32 +.css 32 +.sass 32 +.scss 32 +.less 32 +.js 32 +.coffee 32 +.man 32 +.0 32 +.1 32 +.2 32 +.3 32 +.4 32 +.5 32 +.6 32 +.7 32 +.8 32 +.9 32 +.l 32 +.n 32 +.p 32 +.pod 32 +.tex 32 + +### Multimedia formats + +# Image +.bmp 33 +.cgm 33 +.dl 33 +.dvi 33 +.emf 33 +.eps 33 +.gif 33 +.jpeg 33 +.jpg 33 +.JPG 33 +.mng 33 +.pbm 33 +.pcx 33 +.pdf 33 +.pgm 33 +.png 33 +.ppm 33 +.pps 33 +.ppsx 33 +.ps 33 +.svg 33 +.svgz 33 +.tga 33 +.tif 33 +.tiff 33 +.xbm 33 +.xcf 33 +.xpm 33 +.xwd 33 +.xwd 33 +.yuv 33 + +# Audio +.aac 33 +.au 33 +.flac 33 +.mid 33 +.midi 33 +.mka 33 +.mp3 33 +.mpa 33 +.mpeg 33 +.mpg 33 +.ogg 33 +.ra 33 +.wav 33 + +# Video +.anx 33 +.asf 33 +.avi 33 +.axv 33 +.flc 33 +.fli 33 +.flv 33 +.gl 33 +.m2v 33 +.m4v 33 +.mkv 33 +.mov 33 +.mp4 33 +.mp4v 33 +.mpeg 33 +.mpg 33 +.nuv 33 +.ogm 33 +.ogv 33 +.ogx 33 +.qt 33 +.rm 33 +.rmvb 33 +.swf 33 +.vob 33 +.wmv 33 + +### Misc + +# Binary document formats and multimedia source +.doc 31 +.docx 31 +.rtf 31 +.dot 31 +.dotx 31 +.xls 31 +.xlsx 31 +.ppt 31 +.pptx 31 +.fla 31 +.psd 31 + +# Archives, compressed +.7z 1;35 +.apk 1;35 +.arj 1;35 +.bin 1;35 +.bz 1;35 +.bz2 1;35 +.cab 1;35 # Win +.deb 1;35 +.dmg 1;35 # OSX +.gem 1;35 +.gz 1;35 +.iso 1;35 +.jar 1;35 +.msi 1;35 # Win +.rar 1;35 +.rpm 1;35 +.tar 1;35 +.tbz 1;35 +.tbz2 1;35 +.tgz 1;35 +.tx 1;35 +.war 1;35 +.xpi 1;35 +.xz 1;35 +.z 1;35 +.Z 1;35 +.zip 1;35 + +# For testing +.ANSI-30-black 30 +.ANSI-01;30-brblack 01;30 +.ANSI-31-red 31 +.ANSI-01;31-brred 01;31 +.ANSI-32-green 32 +.ANSI-01;32-brgreen 01;32 +.ANSI-33-yellow 33 +.ANSI-01;33-bryellow 01;33 +.ANSI-34-blue 34 +.ANSI-01;34-brblue 01;34 +.ANSI-35-magenta 35 +.ANSI-01;35-brmagenta 01;35 +.ANSI-36-cyan 36 +.ANSI-01;36-brcyan 01;36 +.ANSI-37-white 37 +.ANSI-01;37-brwhite 01;37 + +.log 01;32 +*~ 01;32 +*# 01;32 + +.bak 01;33 +.BAK 01;33 +.old 01;33 +.OLD 01;33 +.org_archive 01;33 +.off 01;33 +.OFF 01;33 +.dist 01;33 +.DIST 01;33 +.orig 01;33 +.ORIG 01;33 +.swp 01;33 +.swo 01;33 +*,v 01;33 +.gpg 34 +.gpg 34 +.pgp 34 +.asc 34 +.3des 34 +.aes 34 +.enc 34 diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..9fe3ded --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +. +!Dockerfile +!install diff --git a/.gitconfig b/.gitconfig new file mode 100644 index 0000000..1079613 --- /dev/null +++ b/.gitconfig @@ -0,0 +1,5 @@ +# This is Git's per-user configuration file. +[user] +# Please adapt and uncomment the following lines: +name = Rob Muhlestein +email = rob@rwx.gg diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..32786aa --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,14 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: rwxrob +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with the name of a liberpay project +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: +- https://twitch.tv/rwxrob +- https://youtube.com/rwxrob diff --git a/.inputrc b/.inputrc new file mode 100644 index 0000000..a0276f5 --- /dev/null +++ b/.inputrc @@ -0,0 +1,4 @@ +# particularly useful for psql +set editing-mode vi +#set bell-style none # MAKE IT STOP!! +set keymap vi diff --git a/.profile b/.profile new file mode 100644 index 0000000..7a0486a --- /dev/null +++ b/.profile @@ -0,0 +1,9 @@ +# This file is only here because some brain-dead +# applications require it. + +if [ -n "$BASH_VERSION" ]; then + # include .bashrc if it exists + if [ -f "$HOME/.bashrc" ]; then + . "$HOME/.bashrc" + fi +fi diff --git a/DCO b/DCO new file mode 100644 index 0000000..36fe7b6 --- /dev/null +++ b/DCO @@ -0,0 +1,36 @@ +Developer Certificate of Origin +Version 1.1 + +Copyright (C) 2004, 2006 The Linux Foundation and its contributors. +1 Letterman Drive +Suite D4700 +San Francisco, CA, 94129 + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +(b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e0b334b --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2020 Rob Muhlestein + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md new file mode 100644 index 0000000..78935a0 --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ +# Personal Dotfiles and Scripts + +Pilfer at your own peril. Mention if you do. Stop by +and chat sometime. + +## Installation + +For installation information and sampling see the [workspace container] +that depends on this repo. + +Also see the [scripts `README.md` Installation][scripts] as well. + +[workspace container]: +[scripts]: scripts/#installation + +## More Information + +For questions about design decisions and setup consider my [zet notes] +and [streaming faq]. + +[zet notes]: +[streaming faq]: + +## Legal + +Copyright 2021 Rob Muhlestein +Released under Apache-1.0 License +Please mention diff --git a/ansible/README.md b/ansible/README.md new file mode 100644 index 0000000..26d83d5 --- /dev/null +++ b/ansible/README.md @@ -0,0 +1,6 @@ +# My Ansible Stuff + +> ⚠️ +> A lot of this is duplicated in the installer files (for now) until +> I can migrate it all over. + diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..17d96d0 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,3 @@ +# Docker Completion + +Add `d` to the `complete` line at the end. diff --git a/docker/completion b/docker/completion new file mode 100644 index 0000000..f39eb69 --- /dev/null +++ b/docker/completion @@ -0,0 +1,5629 @@ +#!/usr/bin/env bash +# shellcheck disable=SC2016,SC2119,SC2155,SC2206,SC2207 +# +# Shellcheck ignore list: +# - SC2016: Expressions don't expand in single quotes, use double quotes for that. +# - SC2119: Use foo "$@" if function's $1 should mean script's $1. +# - SC2155: Declare and assign separately to avoid masking return values. +# - SC2206: Quote to prevent word splitting, or split robustly with mapfile or read -a. +# - SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting). +# +# You can find more details for each warning at the following page: +# https://github.com/koalaman/shellcheck/wiki/ +# +# bash completion file for core docker commands +# +# This script provides completion of: +# - commands and their options +# - container ids and names +# - image repos and tags +# - filepaths +# +# To enable the completions either: +# - place this file in /etc/bash_completion.d +# or +# - copy this file to e.g. ~/.docker-completion.sh and add the line +# below to your .bashrc after bash completion features are loaded +# . ~/.docker-completion.sh +# +# Configuration: +# +# For several commands, the amount of completions can be configured by +# setting environment variables. +# +# DOCKER_COMPLETION_SHOW_CONFIG_IDS +# DOCKER_COMPLETION_SHOW_CONTAINER_IDS +# DOCKER_COMPLETION_SHOW_NETWORK_IDS +# DOCKER_COMPLETION_SHOW_NODE_IDS +# DOCKER_COMPLETION_SHOW_PLUGIN_IDS +# DOCKER_COMPLETION_SHOW_SECRET_IDS +# DOCKER_COMPLETION_SHOW_SERVICE_IDS +# "no" - Show names only (default) +# "yes" - Show names and ids +# +# You can tailor completion for the "events", "history", "inspect", "run", +# "rmi" and "save" commands by settings the following environment +# variables: +# +# DOCKER_COMPLETION_SHOW_IMAGE_IDS +# "none" - Show names only (default) +# "non-intermediate" - Show names and ids, but omit intermediate image IDs +# "all" - Show names and ids, including intermediate image IDs +# +# DOCKER_COMPLETION_SHOW_TAGS +# "yes" - include tags in completion options (default) +# "no" - don't include tags in completion options + +# +# Note: +# Currently, the completions will not work if the docker daemon is not +# bound to the default communication port/socket +# If the docker daemon is using a unix socket for communication your user +# must have access to the socket for the completions to function correctly +# +# Note for developers: +# Please arrange options sorted alphabetically by long name with the short +# options immediately following their corresponding long form. +# This order should be applied to lists, alternatives and code blocks. + +__docker_previous_extglob_setting=$(shopt -p extglob) +shopt -s extglob + +__docker_q() { + docker ${host:+--host "$host"} ${config:+--config "$config"} ${context:+--context "$context"} 2>/dev/null "$@" +} + +# __docker_configs returns a list of configs. Additional options to +# `docker config ls` may be specified in order to filter the list, e.g. +# `__docker_configs --filter label=stage=production`. +# By default, only names are returned. +# Set DOCKER_COMPLETION_SHOW_CONFIG_IDS=yes to also complete IDs. +# An optional first option `--id|--name` may be used to limit the +# output to the IDs or names of matching items. This setting takes +# precedence over the environment setting. +__docker_configs() { + local format + if [ "$1" = "--id" ] ; then + format='{{.ID}}' + shift + elif [ "$1" = "--name" ] ; then + format='{{.Name}}' + shift + elif [ "$DOCKER_COMPLETION_SHOW_CONFIG_IDS" = yes ] ; then + format='{{.ID}} {{.Name}}' + else + format='{{.Name}}' + fi + + __docker_q config ls --format "$format" "$@" +} + +# __docker_complete_configs applies completion of configs based on the current value +# of `$cur` or the value of the optional first option `--cur`, if given. +__docker_complete_configs() { + local current="$cur" + if [ "$1" = "--cur" ] ; then + current="$2" + shift 2 + fi + COMPREPLY=( $(compgen -W "$(__docker_configs "$@")" -- "$current") ) +} + +# __docker_containers returns a list of containers. Additional options to +# `docker ps` may be specified in order to filter the list, e.g. +# `__docker_containers --filter status=running` +# By default, only names are returned. +# Set DOCKER_COMPLETION_SHOW_CONTAINER_IDS=yes to also complete IDs. +# An optional first option `--id|--name` may be used to limit the +# output to the IDs or names of matching items. This setting takes +# precedence over the environment setting. +__docker_containers() { + local format + if [ "$1" = "--id" ] ; then + format='{{.ID}}' + shift + elif [ "$1" = "--name" ] ; then + format='{{.Names}}' + shift + elif [ "${DOCKER_COMPLETION_SHOW_CONTAINER_IDS}" = yes ] ; then + format='{{.ID}} {{.Names}}' + else + format='{{.Names}}' + fi + __docker_q ps --format "$format" "$@" +} + +# __docker_complete_containers applies completion of containers based on the current +# value of `$cur` or the value of the optional first option `--cur`, if given. +# Additional filters may be appended, see `__docker_containers`. +__docker_complete_containers() { + local current="$cur" + if [ "$1" = "--cur" ] ; then + current="$2" + shift 2 + fi + COMPREPLY=( $(compgen -W "$(__docker_containers "$@")" -- "$current") ) +} + +__docker_complete_containers_all() { + __docker_complete_containers "$@" --all +} + +# shellcheck disable=SC2120 +__docker_complete_containers_removable() { + __docker_complete_containers "$@" --filter status=created --filter status=exited +} + +__docker_complete_containers_running() { + __docker_complete_containers "$@" --filter status=running +} + +# shellcheck disable=SC2120 +__docker_complete_containers_stoppable() { + __docker_complete_containers "$@" --filter status=running --filter status=paused +} + +# shellcheck disable=SC2120 +__docker_complete_containers_stopped() { + __docker_complete_containers "$@" --filter status=exited +} + +# shellcheck disable=SC2120 +__docker_complete_containers_unpauseable() { + __docker_complete_containers "$@" --filter status=paused +} + +__docker_complete_container_names() { + local containers=( $(__docker_q ps -aq --no-trunc) ) + local names=( $(__docker_q inspect --format '{{.Name}}' "${containers[@]}") ) + names=( "${names[@]#/}" ) # trim off the leading "/" from the container names + COMPREPLY=( $(compgen -W "${names[*]}" -- "$cur") ) +} + +__docker_complete_container_ids() { + local containers=( $(__docker_q ps -aq) ) + COMPREPLY=( $(compgen -W "${containers[*]}" -- "$cur") ) +} + +# __docker_contexts returns a list of contexts without the special "default" context. +# Completions may be added with `--add`, e.g. `--add default`. +__docker_contexts() { + local add=() + while true ; do + case "$1" in + --add) + add+=("$2") + shift 2 + ;; + *) + break + ;; + esac + done + __docker_q context ls -q + echo "${add[@]}" +} + +__docker_complete_contexts() { + local contexts=( $(__docker_contexts "$@") ) + COMPREPLY=( $(compgen -W "${contexts[*]}" -- "$cur") ) +} + + +# __docker_images returns a list of images. For each image, up to three representations +# can be generated: the repository (e.g. busybox), repository:tag (e.g. busybox:latest) +# and the ID (e.g. sha256:ee22cbbd4ea3dff63c86ba60c7691287c321e93adfc1009604eb1dde7ec88645). +# +# The optional arguments `--repo`, `--tag` and `--id` select the representations that +# may be returned. Whether or not a particular representation is actually returned +# depends on the user's customization through several environment variables: +# - image IDs are only shown if DOCKER_COMPLETION_SHOW_IMAGE_IDS=all|non-intermediate. +# - tags can be excluded by setting DOCKER_COMPLETION_SHOW_TAGS=no. +# - repositories are always shown. +# +# In cases where an exact image specification is needed, `--force-tag` can be used. +# It ignores DOCKER_COMPLETION_SHOW_TAGS and only lists valid repository:tag combinations, +# avoiding repository names that would default to a potentially missing default tag. +# +# Additional arguments to `docker image ls` may be specified in order to filter the list, +# e.g. `__docker_images --filter dangling=true`. +# +__docker_images() { + local repo_format='{{.Repository}}' + local tag_format='{{.Repository}}:{{.Tag}}' + local id_format='{{.ID}}' + local all + local format + + if [ "$DOCKER_COMPLETION_SHOW_IMAGE_IDS" = "all" ] ; then + all='--all' + fi + + while true ; do + case "$1" in + --repo) + format+="$repo_format\n" + shift + ;; + --tag) + if [ "${DOCKER_COMPLETION_SHOW_TAGS:-yes}" = "yes" ]; then + format+="$tag_format\n" + fi + shift + ;; + --id) + if [[ $DOCKER_COMPLETION_SHOW_IMAGE_IDS =~ ^(all|non-intermediate)$ ]] ; then + format+="$id_format\n" + fi + shift + ;; + --force-tag) + # like `--tag` but ignores environment setting + format+="$tag_format\n" + shift + ;; + *) + break + ;; + esac + done + + __docker_q image ls --no-trunc --format "${format%\\n}" $all "$@" | grep -v '$' +} + +# __docker_complete_images applies completion of images based on the current value of `$cur` or +# the value of the optional first option `--cur`, if given. +# See __docker_images for customization of the returned items. +__docker_complete_images() { + local current="$cur" + if [ "$1" = "--cur" ] ; then + current="$2" + shift 2 + fi + COMPREPLY=( $(compgen -W "$(__docker_images "$@")" -- "$current") ) + __ltrim_colon_completions "$current" +} + +# __docker_networks returns a list of all networks. Additional options to +# `docker network ls` may be specified in order to filter the list, e.g. +# `__docker_networks --filter type=custom` +# By default, only names are returned. +# Set DOCKER_COMPLETION_SHOW_NETWORK_IDS=yes to also complete IDs. +# An optional first option `--id|--name` may be used to limit the +# output to the IDs or names of matching items. This setting takes +# precedence over the environment setting. +__docker_networks() { + local format + if [ "$1" = "--id" ] ; then + format='{{.ID}}' + shift + elif [ "$1" = "--name" ] ; then + format='{{.Name}}' + shift + elif [ "${DOCKER_COMPLETION_SHOW_NETWORK_IDS}" = yes ] ; then + format='{{.ID}} {{.Name}}' + else + format='{{.Name}}' + fi + __docker_q network ls --format "$format" "$@" +} + +# __docker_complete_networks applies completion of networks based on the current +# value of `$cur` or the value of the optional first option `--cur`, if given. +# Additional filters may be appended, see `__docker_networks`. +__docker_complete_networks() { + local current="$cur" + if [ "$1" = "--cur" ] ; then + current="$2" + shift 2 + fi + COMPREPLY=( $(compgen -W "$(__docker_networks "$@")" -- "$current") ) +} + +__docker_complete_containers_in_network() { + local containers=($(__docker_q network inspect -f '{{range $i, $c := .Containers}}{{$i}} {{$c.Name}} {{end}}' "$1")) + COMPREPLY=( $(compgen -W "${containers[*]}" -- "$cur") ) +} + +# __docker_volumes returns a list of all volumes. Additional options to +# `docker volume ls` may be specified in order to filter the list, e.g. +# `__docker_volumes --filter dangling=true` +# Because volumes do not have IDs, this function does not distinguish between +# IDs and names. +__docker_volumes() { + __docker_q volume ls -q "$@" +} + +# __docker_complete_volumes applies completion of volumes based on the current +# value of `$cur` or the value of the optional first option `--cur`, if given. +# Additional filters may be appended, see `__docker_volumes`. +__docker_complete_volumes() { + local current="$cur" + if [ "$1" = "--cur" ] ; then + current="$2" + shift 2 + fi + COMPREPLY=( $(compgen -W "$(__docker_volumes "$@")" -- "$current") ) +} + +# __docker_plugins_bundled returns a list of all plugins of a given type. +# The type has to be specified with the mandatory option `--type`. +# Valid types are: Network, Volume, Authorization. +# Completions may be added or removed with `--add` and `--remove` +# This function only deals with plugins that come bundled with Docker. +# For plugins managed by `docker plugin`, see `__docker_plugins_installed`. +__docker_plugins_bundled() { + local type add=() remove=() + while true ; do + case "$1" in + --type) + type="$2" + shift 2 + ;; + --add) + add+=("$2") + shift 2 + ;; + --remove) + remove+=("$2") + shift 2 + ;; + *) + break + ;; + esac + done + + local plugins=($(__docker_q info --format "{{range \$i, \$p := .Plugins.$type}}{{.}} {{end}}")) + for del in "${remove[@]}" ; do + plugins=(${plugins[@]/$del/}) + done + echo "${plugins[@]}" "${add[@]}" +} + +# __docker_complete_plugins_bundled applies completion of plugins based on the current +# value of `$cur` or the value of the optional first option `--cur`, if given. +# The plugin type has to be specified with the next option `--type`. +# This function only deals with plugins that come bundled with Docker. +# For completion of plugins managed by `docker plugin`, see +# `__docker_complete_plugins_installed`. +__docker_complete_plugins_bundled() { + local current="$cur" + if [ "$1" = "--cur" ] ; then + current="$2" + shift 2 + fi + COMPREPLY=( $(compgen -W "$(__docker_plugins_bundled "$@")" -- "$current") ) +} + +# __docker_plugins_installed returns a list of all plugins that were installed with +# the Docker plugin API. +# By default, only names are returned. +# Set DOCKER_COMPLETION_SHOW_PLUGIN_IDS=yes to also complete IDs. +# Additional options to `docker plugin ls` may be specified in order to filter the list, +# e.g. `__docker_plugins_installed --filter enabled=true` +# For built-in pugins, see `__docker_plugins_bundled`. +__docker_plugins_installed() { + local format + if [ "$DOCKER_COMPLETION_SHOW_PLUGIN_IDS" = yes ] ; then + format='{{.ID}} {{.Name}}' + else + format='{{.Name}}' + fi + __docker_q plugin ls --format "$format" "$@" +} + +# __docker_complete_plugins_installed applies completion of plugins that were installed +# with the Docker plugin API, based on the current value of `$cur` or the value of +# the optional first option `--cur`, if given. +# Additional filters may be appended, see `__docker_plugins_installed`. +# For completion of built-in pugins, see `__docker_complete_plugins_bundled`. +__docker_complete_plugins_installed() { + local current="$cur" + if [ "$1" = "--cur" ] ; then + current="$2" + shift 2 + fi + COMPREPLY=( $(compgen -W "$(__docker_plugins_installed "$@")" -- "$current") ) +} + +__docker_runtimes() { + __docker_q info | sed -n 's/^Runtimes: \(.*\)/\1/p' +} + +__docker_complete_runtimes() { + COMPREPLY=( $(compgen -W "$(__docker_runtimes)" -- "$cur") ) +} + +# __docker_secrets returns a list of secrets. Additional options to +# `docker secret ls` may be specified in order to filter the list, e.g. +# `__docker_secrets --filter label=stage=production` +# By default, only names are returned. +# Set DOCKER_COMPLETION_SHOW_SECRET_IDS=yes to also complete IDs. +# An optional first option `--id|--name` may be used to limit the +# output to the IDs or names of matching items. This setting takes +# precedence over the environment setting. +__docker_secrets() { + local format + if [ "$1" = "--id" ] ; then + format='{{.ID}}' + shift + elif [ "$1" = "--name" ] ; then + format='{{.Name}}' + shift + elif [ "$DOCKER_COMPLETION_SHOW_SECRET_IDS" = yes ] ; then + format='{{.ID}} {{.Name}}' + else + format='{{.Name}}' + fi + + __docker_q secret ls --format "$format" "$@" +} + +# __docker_complete_secrets applies completion of secrets based on the current value +# of `$cur` or the value of the optional first option `--cur`, if given. +__docker_complete_secrets() { + local current="$cur" + if [ "$1" = "--cur" ] ; then + current="$2" + shift 2 + fi + COMPREPLY=( $(compgen -W "$(__docker_secrets "$@")" -- "$current") ) +} + +# __docker_stacks returns a list of all stacks. +__docker_stacks() { + __docker_q stack ls | awk 'NR>1 {print $1}' +} + +# __docker_complete_stacks applies completion of stacks based on the current value +# of `$cur` or the value of the optional first option `--cur`, if given. +__docker_complete_stacks() { + local current="$cur" + if [ "$1" = "--cur" ] ; then + current="$2" + shift 2 + fi + COMPREPLY=( $(compgen -W "$(__docker_stacks "$@")" -- "$current") ) +} + +# __docker_nodes returns a list of all nodes. Additional options to +# `docker node ls` may be specified in order to filter the list, e.g. +# `__docker_nodes --filter role=manager` +# By default, only node names are returned. +# Set DOCKER_COMPLETION_SHOW_NODE_IDS=yes to also complete node IDs. +# An optional first option `--id|--name` may be used to limit the +# output to the IDs or names of matching items. This setting takes +# precedence over the environment setting. +# Completions may be added with `--add`, e.g. `--add self`. +__docker_nodes() { + local format + if [ "$DOCKER_COMPLETION_SHOW_NODE_IDS" = yes ] ; then + format='{{.ID}} {{.Hostname}}' + else + format='{{.Hostname}}' + fi + + local add=() + + while true ; do + case "$1" in + --id) + format='{{.ID}}' + shift + ;; + --name) + format='{{.Hostname}}' + shift + ;; + --add) + add+=("$2") + shift 2 + ;; + *) + break + ;; + esac + done + + echo "$(__docker_q node ls --format "$format" "$@")" "${add[@]}" +} + +# __docker_complete_nodes applies completion of nodes based on the current +# value of `$cur` or the value of the optional first option `--cur`, if given. +# Additional filters may be appended, see `__docker_nodes`. +__docker_complete_nodes() { + local current="$cur" + if [ "$1" = "--cur" ] ; then + current="$2" + shift 2 + fi + COMPREPLY=( $(compgen -W "$(__docker_nodes "$@")" -- "$current") ) +} + +# __docker_services returns a list of all services. Additional options to +# `docker service ls` may be specified in order to filter the list, e.g. +# `__docker_services --filter name=xxx` +# By default, only node names are returned. +# Set DOCKER_COMPLETION_SHOW_SERVICE_IDS=yes to also complete IDs. +# An optional first option `--id|--name` may be used to limit the +# output to the IDs or names of matching items. This setting takes +# precedence over the environment setting. +__docker_services() { + local format='{{.Name}}' # default: service name only + [ "${DOCKER_COMPLETION_SHOW_SERVICE_IDS}" = yes ] && format='{{.ID}} {{.Name}}' # ID & name + + if [ "$1" = "--id" ] ; then + format='{{.ID}}' # IDs only + shift + elif [ "$1" = "--name" ] ; then + format='{{.Name}}' # names only + shift + fi + + __docker_q service ls --quiet --format "$format" "$@" +} + +# __docker_complete_services applies completion of services based on the current +# value of `$cur` or the value of the optional first option `--cur`, if given. +# Additional filters may be appended, see `__docker_services`. +__docker_complete_services() { + local current="$cur" + if [ "$1" = "--cur" ] ; then + current="$2" + shift 2 + fi + COMPREPLY=( $(__docker_services "$@" --filter "name=$current") ) +} + +# __docker_tasks returns a list of all task IDs. +__docker_tasks() { + __docker_q service ps --format '{{.ID}}' "" +} + +# __docker_complete_services_and_tasks applies completion of services and task IDs. +# shellcheck disable=SC2120 +__docker_complete_services_and_tasks() { + COMPREPLY=( $(compgen -W "$(__docker_services "$@") $(__docker_tasks)" -- "$cur") ) +} + +# __docker_append_to_completions appends the word passed as an argument to every +# word in `$COMPREPLY`. +# Normally you do this with `compgen -S` while generating the completions. +# This function allows you to append a suffix later. It allows you to use +# the __docker_complete_XXX functions in cases where you need a suffix. +__docker_append_to_completions() { + COMPREPLY=( ${COMPREPLY[@]/%/"$1"} ) +} + +# __docker_fetch_info fetches information about the configured Docker server and updates +# several variables with the results. +# The result is cached for the duration of one invocation of bash completion. +__docker_fetch_info() { + if [ -z "$info_fetched" ] ; then + read -r client_experimental server_experimental server_os <<< "$(__docker_q version -f '{{.Client.Experimental}} {{.Server.Experimental}} {{.Server.Os}}')" + info_fetched=true + fi +} + +# __docker_client_is_experimental tests whether the Docker cli is configured to support +# experimental features. If so, the function exits with 0 (true). +# Otherwise, or if the result cannot be determined, the exit value is 1 (false). +__docker_client_is_experimental() { + __docker_fetch_info + [ "$client_experimental" = "true" ] +} + +# __docker_server_is_experimental tests whether the currently configured Docker +# server runs in experimental mode. If so, the function exits with 0 (true). +# Otherwise, or if the result cannot be determined, the exit value is 1 (false). +__docker_server_is_experimental() { + __docker_fetch_info + [ "$server_experimental" = "true" ] +} + +# __docker_server_os_is tests whether the currently configured Docker server runs +# on the operating system passed in as the first argument. +# Known operating systems: linux, windows. +__docker_server_os_is() { + local expected_os="$1" + __docker_fetch_info + [ "$server_os" = "$expected_os" ] +} + +# __docker_stack_orchestrator_is tests whether the client is configured to use +# the orchestrator that is passed in as the first argument. +__docker_stack_orchestrator_is() { + case "$1" in + kubernetes) + if [ -z "$stack_orchestrator_is_kubernetes" ] ; then + __docker_q stack ls --help | grep -qe --namespace + stack_orchestrator_is_kubernetes=$? + fi + return $stack_orchestrator_is_kubernetes + ;; + swarm) + if [ -z "$stack_orchestrator_is_swarm" ] ; then + __docker_q stack deploy --help | grep -qe "with-registry-auth" + stack_orchestrator_is_swarm=$? + fi + return $stack_orchestrator_is_swarm + ;; + *) + return 1 + ;; + + esac +} + +# __docker_pos_first_nonflag finds the position of the first word that is neither +# option nor an option's argument. If there are options that require arguments, +# you should pass a glob describing those options, e.g. "--option1|-o|--option2" +# Use this function to restrict completions to exact positions after the argument list. +__docker_pos_first_nonflag() { + local argument_flags=$1 + + local counter=$((${subcommand_pos:-${command_pos}} + 1)) + while [ "$counter" -le "$cword" ]; do + if [ -n "$argument_flags" ] && eval "case '${words[$counter]}' in $argument_flags) true ;; *) false ;; esac"; then + (( counter++ )) + # eat "=" in case of --option=arg syntax + [ "${words[$counter]}" = "=" ] && (( counter++ )) + else + case "${words[$counter]}" in + -*) + ;; + *) + break + ;; + esac + fi + + # Bash splits words at "=", retaining "=" as a word, examples: + # "--debug=false" => 3 words, "--log-opt syslog-facility=daemon" => 4 words + while [ "${words[$counter + 1]}" = "=" ] ; do + counter=$(( counter + 2)) + done + + (( counter++ )) + done + + echo $counter +} + +# __docker_map_key_of_current_option returns `key` if we are currently completing the +# value of a map option (`key=value`) which matches the extglob given as an argument. +# This function is needed for key-specific completions. +__docker_map_key_of_current_option() { + local glob="$1" + + local key glob_pos + if [ "$cur" = "=" ] ; then # key= case + key="$prev" + glob_pos=$((cword - 2)) + elif [[ $cur == *=* ]] ; then # key=value case (OSX) + key=${cur%=*} + glob_pos=$((cword - 1)) + elif [ "$prev" = "=" ] ; then + key=${words[$cword - 2]} # key=value case + glob_pos=$((cword - 3)) + else + return + fi + + [ "${words[$glob_pos]}" = "=" ] && ((glob_pos--)) # --option=key=value syntax + + [[ ${words[$glob_pos]} == @($glob) ]] && echo "$key" +} + +# __docker_value_of_option returns the value of the first option matching `option_glob`. +# Valid values for `option_glob` are option names like `--log-level` and globs like +# `--log-level|-l` +# Only positions between the command and the current word are considered. +__docker_value_of_option() { + local option_extglob=$(__docker_to_extglob "$1") + + local counter=$((command_pos + 1)) + while [ "$counter" -lt "$cword" ]; do + case ${words[$counter]} in + $option_extglob ) + echo "${words[$counter + 1]}" + break + ;; + esac + (( counter++ )) + done +} + +# __docker_to_alternatives transforms a multiline list of strings into a single line +# string with the words separated by `|`. +# This is used to prepare arguments to __docker_pos_first_nonflag(). +__docker_to_alternatives() { + local parts=( $1 ) + local IFS='|' + echo "${parts[*]}" +} + +# __docker_to_extglob transforms a multiline list of options into an extglob pattern +# suitable for use in case statements. +__docker_to_extglob() { + local extglob=$( __docker_to_alternatives "$1" ) + echo "@($extglob)" +} + +# __docker_subcommands processes subcommands +# Locates the first occurrence of any of the subcommands contained in the +# first argument. In case of a match, calls the corresponding completion +# function and returns 0. +# If no match is found, 1 is returned. The calling function can then +# continue processing its completion. +# +# TODO if the preceding command has options that accept arguments and an +# argument is equal ot one of the subcommands, this is falsely detected as +# a match. +__docker_subcommands() { + local subcommands="$1" + + local counter=$((command_pos + 1)) + while [ "$counter" -lt "$cword" ]; do + case "${words[$counter]}" in + $(__docker_to_extglob "$subcommands") ) + subcommand_pos=$counter + local subcommand=${words[$counter]} + local completions_func=_docker_${command}_${subcommand//-/_} + declare -F "$completions_func" >/dev/null && "$completions_func" + return 0 + ;; + esac + (( counter++ )) + done + return 1 +} + +# __docker_nospace suppresses trailing whitespace +__docker_nospace() { + # compopt is not available in ancient bash versions + type compopt &>/dev/null && compopt -o nospace +} + +__docker_complete_resolved_hostname() { + command -v host >/dev/null 2>&1 || return + COMPREPLY=( $(host 2>/dev/null "${cur%:}" | awk '/has address/ {print $4}') ) +} + +# __docker_local_interfaces returns a list of the names and addresses of all +# local network interfaces. +# If `--ip-only` is passed as a first argument, only addresses are returned. +__docker_local_interfaces() { + command -v ip >/dev/null 2>&1 || return + + local format + if [ "$1" = "--ip-only" ] ; then + format='\1' + shift + else + format='\1 \2' + fi + + ip addr show scope global 2>/dev/null | sed -n "s| \+inet \([0-9.]\+\).* \([^ ]\+\)|$format|p" +} + +# __docker_complete_local_interfaces applies completion of the names and addresses of all +# local network interfaces based on the current value of `$cur`. +# An additional value can be added to the possible completions with an `--add` argument. +__docker_complete_local_interfaces() { + local additional_interface + if [ "$1" = "--add" ] ; then + additional_interface="$2" + shift 2 + fi + + COMPREPLY=( $( compgen -W "$(__docker_local_interfaces "$@") $additional_interface" -- "$cur" ) ) +} + +# __docker_complete_local_ips applies completion of the addresses of all local network +# interfaces based on the current value of `$cur`. +__docker_complete_local_ips() { + __docker_complete_local_interfaces --ip-only +} + +# __docker_complete_capabilities_addable completes Linux capabilities which are +# not granted by default and may be added. +# see https://docs.docker.com/engine/reference/run/#/runtime-privilege-and-linux-capabilities +__docker_complete_capabilities_addable() { + COMPREPLY=( $( compgen -W " + ALL + AUDIT_CONTROL + BLOCK_SUSPEND + DAC_READ_SEARCH + IPC_LOCK + IPC_OWNER + LEASE + LINUX_IMMUTABLE + MAC_ADMIN + MAC_OVERRIDE + NET_ADMIN + NET_BROADCAST + SYS_ADMIN + SYS_BOOT + SYSLOG + SYS_MODULE + SYS_NICE + SYS_PACCT + SYS_PTRACE + SYS_RAWIO + SYS_RESOURCE + SYS_TIME + SYS_TTY_CONFIG + WAKE_ALARM + " -- "$cur" ) ) +} + +# __docker_complete_capabilities_droppable completes Linux capability options which are +# allowed by default and can be dropped. +# see https://docs.docker.com/engine/reference/run/#/runtime-privilege-and-linux-capabilities +__docker_complete_capabilities_droppable() { + COMPREPLY=( $( compgen -W " + ALL + AUDIT_WRITE + CHOWN + DAC_OVERRIDE + FOWNER + FSETID + KILL + MKNOD + NET_BIND_SERVICE + NET_RAW + SETFCAP + SETGID + SETPCAP + SETUID + SYS_CHROOT + " -- "$cur" ) ) +} + +__docker_complete_detach_keys() { + case "$prev" in + --detach-keys) + case "$cur" in + *,) + COMPREPLY=( $( compgen -W "${cur}ctrl-" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "ctrl-" -- "$cur" ) ) + ;; + esac + + __docker_nospace + return + ;; + esac + return 1 +} + +__docker_complete_isolation() { + COMPREPLY=( $( compgen -W "default hyperv process" -- "$cur" ) ) +} + +__docker_complete_log_drivers() { + COMPREPLY=( $( compgen -W " + awslogs + etwlogs + fluentd + gcplogs + gelf + journald + json-file + local + logentries + none + splunk + syslog + " -- "$cur" ) ) +} + +__docker_complete_log_options() { + # see repository docker/docker.github.io/engine/admin/logging/ + + # really global options, defined in https://github.com/moby/moby/blob/master/daemon/logger/factory.go + local common_options1="max-buffer-size mode" + # common options defined in https://github.com/moby/moby/blob/master/daemon/logger/loginfo.go + # but not implemented in all log drivers + local common_options2="env env-regex labels" + + # awslogs does not implement the $common_options2. + local awslogs_options="$common_options1 awslogs-create-group awslogs-credentials-endpoint awslogs-datetime-format awslogs-group awslogs-multiline-pattern awslogs-region awslogs-stream tag" + + local fluentd_options="$common_options1 $common_options2 fluentd-address fluentd-async-connect fluentd-buffer-limit fluentd-retry-wait fluentd-max-retries fluentd-sub-second-precision tag" + local gcplogs_options="$common_options1 $common_options2 gcp-log-cmd gcp-meta-id gcp-meta-name gcp-meta-zone gcp-project" + local gelf_options="$common_options1 $common_options2 gelf-address gelf-compression-level gelf-compression-type gelf-tcp-max-reconnect gelf-tcp-reconnect-delay tag" + local journald_options="$common_options1 $common_options2 tag" + local json_file_options="$common_options1 $common_options2 compress max-file max-size" + local local_options="$common_options1 compress max-file max-size" + local logentries_options="$common_options1 $common_options2 line-only logentries-token tag" + local splunk_options="$common_options1 $common_options2 splunk-caname splunk-capath splunk-format splunk-gzip splunk-gzip-level splunk-index splunk-insecureskipverify splunk-source splunk-sourcetype splunk-token splunk-url splunk-verify-connection tag" + local syslog_options="$common_options1 $common_options2 syslog-address syslog-facility syslog-format syslog-tls-ca-cert syslog-tls-cert syslog-tls-key syslog-tls-skip-verify tag" + + local all_options="$fluentd_options $gcplogs_options $gelf_options $journald_options $logentries_options $json_file_options $syslog_options $splunk_options" + + case $(__docker_value_of_option --log-driver) in + '') + COMPREPLY=( $( compgen -W "$all_options" -S = -- "$cur" ) ) + ;; + awslogs) + COMPREPLY=( $( compgen -W "$awslogs_options" -S = -- "$cur" ) ) + ;; + fluentd) + COMPREPLY=( $( compgen -W "$fluentd_options" -S = -- "$cur" ) ) + ;; + gcplogs) + COMPREPLY=( $( compgen -W "$gcplogs_options" -S = -- "$cur" ) ) + ;; + gelf) + COMPREPLY=( $( compgen -W "$gelf_options" -S = -- "$cur" ) ) + ;; + journald) + COMPREPLY=( $( compgen -W "$journald_options" -S = -- "$cur" ) ) + ;; + json-file) + COMPREPLY=( $( compgen -W "$json_file_options" -S = -- "$cur" ) ) + ;; + local) + COMPREPLY=( $( compgen -W "$local_options" -S = -- "$cur" ) ) + ;; + logentries) + COMPREPLY=( $( compgen -W "$logentries_options" -S = -- "$cur" ) ) + ;; + syslog) + COMPREPLY=( $( compgen -W "$syslog_options" -S = -- "$cur" ) ) + ;; + splunk) + COMPREPLY=( $( compgen -W "$splunk_options" -S = -- "$cur" ) ) + ;; + *) + return + ;; + esac + + __docker_nospace +} + +__docker_complete_log_driver_options() { + local key=$(__docker_map_key_of_current_option '--log-opt') + case "$key" in + awslogs-create-group) + COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) ) + return + ;; + awslogs-credentials-endpoint) + COMPREPLY=( $( compgen -W "/" -- "${cur##*=}" ) ) + __docker_nospace + return + ;; + compress|fluentd-async-connect) + COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) ) + return + ;; + fluentd-sub-second-precision) + COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) ) + return + ;; + gelf-address) + COMPREPLY=( $( compgen -W "tcp udp" -S "://" -- "${cur##*=}" ) ) + __docker_nospace + return + ;; + gelf-compression-level) + COMPREPLY=( $( compgen -W "1 2 3 4 5 6 7 8 9" -- "${cur##*=}" ) ) + return + ;; + gelf-compression-type) + COMPREPLY=( $( compgen -W "gzip none zlib" -- "${cur##*=}" ) ) + return + ;; + line-only) + COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) ) + return + ;; + mode) + COMPREPLY=( $( compgen -W "blocking non-blocking" -- "${cur##*=}" ) ) + return + ;; + syslog-address) + COMPREPLY=( $( compgen -W "tcp:// tcp+tls:// udp:// unix://" -- "${cur##*=}" ) ) + __docker_nospace + __ltrim_colon_completions "${cur}" + return + ;; + syslog-facility) + COMPREPLY=( $( compgen -W " + auth + authpriv + cron + daemon + ftp + kern + local0 + local1 + local2 + local3 + local4 + local5 + local6 + local7 + lpr + mail + news + syslog + user + uucp + " -- "${cur##*=}" ) ) + return + ;; + syslog-format) + COMPREPLY=( $( compgen -W "rfc3164 rfc5424 rfc5424micro" -- "${cur##*=}" ) ) + return + ;; + syslog-tls-ca-cert|syslog-tls-cert|syslog-tls-key) + _filedir + return + ;; + syslog-tls-skip-verify) + COMPREPLY=( $( compgen -W "true" -- "${cur##*=}" ) ) + return + ;; + splunk-url) + COMPREPLY=( $( compgen -W "http:// https://" -- "${cur##*=}" ) ) + __docker_nospace + __ltrim_colon_completions "${cur}" + return + ;; + splunk-gzip|splunk-insecureskipverify|splunk-verify-connection) + COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) ) + return + ;; + splunk-format) + COMPREPLY=( $( compgen -W "inline json raw" -- "${cur##*=}" ) ) + return + ;; + esac + return 1 +} + +__docker_complete_log_levels() { + COMPREPLY=( $( compgen -W "debug info warn error fatal" -- "$cur" ) ) +} + +__docker_complete_restart() { + case "$prev" in + --restart) + case "$cur" in + on-failure:*) + ;; + *) + COMPREPLY=( $( compgen -W "always no on-failure on-failure: unless-stopped" -- "$cur") ) + ;; + esac + return + ;; + esac + return 1 +} + +# __docker_complete_signals returns a subset of the available signals that is most likely +# relevant in the context of docker containers +__docker_complete_signals() { + local signals=( + SIGCONT + SIGHUP + SIGINT + SIGKILL + SIGQUIT + SIGSTOP + SIGTERM + SIGUSR1 + SIGUSR2 + ) + COMPREPLY=( $( compgen -W "${signals[*]} ${signals[*]#SIG}" -- "$( echo "$cur" | tr '[:lower:]' '[:upper:]')" ) ) +} + +__docker_complete_stack_orchestrator_options() { + case "$prev" in + --kubeconfig) + _filedir + return 0 + ;; + --namespace) + return 0 + ;; + --orchestrator) + COMPREPLY=( $( compgen -W "all kubernetes swarm" -- "$cur") ) + return 0 + ;; + esac + return 1 +} + +__docker_complete_user_group() { + if [[ $cur == *:* ]] ; then + COMPREPLY=( $(compgen -g -- "${cur#*:}") ) + else + COMPREPLY=( $(compgen -u -S : -- "$cur") ) + __docker_nospace + fi +} + +_docker_docker() { + # global options that may appear after the docker command + local boolean_options=" + $global_boolean_options + --help + --version -v + " + + case "$prev" in + --config) + _filedir -d + return + ;; + --context|-c) + __docker_complete_contexts + return + ;; + --log-level|-l) + __docker_complete_log_levels + return + ;; + $(__docker_to_extglob "$global_options_with_args") ) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "$boolean_options $global_options_with_args" -- "$cur" ) ) + ;; + *) + local counter=$( __docker_pos_first_nonflag "$(__docker_to_extglob "$global_options_with_args")" ) + if [ "$cword" -eq "$counter" ]; then + __docker_client_is_experimental && commands+=(${experimental_client_commands[*]}) + __docker_server_is_experimental && commands+=(${experimental_server_commands[*]}) + COMPREPLY=( $( compgen -W "${commands[*]} help" -- "$cur" ) ) + fi + ;; + esac +} + +_docker_attach() { + _docker_container_attach +} + +_docker_build() { + _docker_image_build +} + + +_docker_builder() { + local subcommands=" + build + prune + " + __docker_subcommands "$subcommands" && return + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) + ;; + esac +} + +_docker_builder_build() { + _docker_image_build +} + +_docker_builder_prune() { + case "$prev" in + --filter) + COMPREPLY=( $( compgen -S = -W "description id inuse parent private shared type until unused-for" -- "$cur" ) ) + __docker_nospace + return + ;; + --keep-storage) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--all -a --filter --force -f --help --keep-storage" -- "$cur" ) ) + ;; + esac +} + +_docker_checkpoint() { + local subcommands=" + create + ls + rm + " + local aliases=" + list + remove + " + __docker_subcommands "$subcommands $aliases" && return + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) + ;; + esac +} + +_docker_checkpoint_create() { + case "$prev" in + --checkpoint-dir) + _filedir -d + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--checkpoint-dir --help --leave-running" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag '--checkpoint-dir') + if [ "$cword" -eq "$counter" ]; then + __docker_complete_containers_running + fi + ;; + esac +} + +_docker_checkpoint_ls() { + case "$prev" in + --checkpoint-dir) + _filedir -d + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--checkpoint-dir --help" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag '--checkpoint-dir') + if [ "$cword" -eq "$counter" ]; then + __docker_complete_containers_all + fi + ;; + esac +} + +_docker_checkpoint_rm() { + case "$prev" in + --checkpoint-dir) + _filedir -d + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--checkpoint-dir --help" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag '--checkpoint-dir') + if [ "$cword" -eq "$counter" ]; then + __docker_complete_containers_all + elif [ "$cword" -eq "$((counter + 1))" ]; then + COMPREPLY=( $( compgen -W "$(__docker_q checkpoint ls "$prev" | sed 1d)" -- "$cur" ) ) + fi + ;; + esac +} + + +_docker_config() { + local subcommands=" + create + inspect + ls + rm + " + local aliases=" + list + remove + " + __docker_subcommands "$subcommands $aliases" && return + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) + ;; + esac +} + +_docker_config_create() { + case "$prev" in + --label|-l) + return + ;; + --template-driver) + COMPREPLY=( $( compgen -W "golang" -- "$cur" ) ) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --label -l --template-driver" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag '--label|-l|--template-driver') + if [ "$cword" -eq "$((counter + 1))" ]; then + _filedir + fi + ;; + esac +} + +_docker_config_inspect() { + case "$prev" in + --format|-f) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--format -f --help --pretty" -- "$cur" ) ) + ;; + *) + __docker_complete_configs + ;; + esac +} + +_docker_config_list() { + _docker_config_ls +} + +_docker_config_ls() { + local key=$(__docker_map_key_of_current_option '--filter|-f') + case "$key" in + id) + __docker_complete_configs --cur "${cur##*=}" --id + return + ;; + name) + __docker_complete_configs --cur "${cur##*=}" --name + return + ;; + esac + + case "$prev" in + --filter|-f) + COMPREPLY=( $( compgen -S = -W "id label name" -- "$cur" ) ) + __docker_nospace + return + ;; + --format) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--format --filter -f --help --quiet -q" -- "$cur" ) ) + ;; + esac +} + +_docker_config_remove() { + _docker_config_rm +} + +_docker_config_rm() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + __docker_complete_configs + ;; + esac +} + + +_docker_container() { + local subcommands=" + attach + commit + cp + create + diff + exec + export + inspect + kill + logs + ls + pause + port + prune + rename + restart + rm + run + start + stats + stop + top + unpause + update + wait + " + local aliases=" + list + ps + " + __docker_subcommands "$subcommands $aliases" && return + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) + ;; + esac +} + +_docker_container_attach() { + __docker_complete_detach_keys && return + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--detach-keys --help --no-stdin --sig-proxy=false" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag '--detach-keys') + if [ "$cword" -eq "$counter" ]; then + __docker_complete_containers_running + fi + ;; + esac +} + +_docker_container_commit() { + case "$prev" in + --author|-a|--change|-c|--message|-m) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--author -a --change -c --help --message -m --pause=false -p=false" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag '--author|-a|--change|-c|--message|-m') + + if [ "$cword" -eq "$counter" ]; then + __docker_complete_containers_all + return + elif [ "$cword" -eq "$((counter + 1))" ]; then + __docker_complete_images --repo --tag + return + fi + ;; + esac +} + +_docker_container_cp() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--archive -a --follow-link -L --help" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag) + if [ "$cword" -eq "$counter" ]; then + case "$cur" in + *:) + return + ;; + *) + # combined container and filename completion + _filedir + local files=( ${COMPREPLY[@]} ) + + __docker_complete_containers_all + COMPREPLY=( $( compgen -W "${COMPREPLY[*]}" -S ':' ) ) + local containers=( ${COMPREPLY[@]} ) + + COMPREPLY=( $( compgen -W "${files[*]} ${containers[*]}" -- "$cur" ) ) + if [[ "${COMPREPLY[*]}" = *: ]]; then + __docker_nospace + fi + return + ;; + esac + fi + (( counter++ )) + + if [ "$cword" -eq "$counter" ]; then + if [ -e "$prev" ]; then + __docker_complete_containers_all + COMPREPLY=( $( compgen -W "${COMPREPLY[*]}" -S ':' ) ) + __docker_nospace + else + _filedir + fi + return + fi + ;; + esac +} + +_docker_container_create() { + _docker_container_run_and_create +} + +_docker_container_diff() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag) + if [ "$cword" -eq "$counter" ]; then + __docker_complete_containers_all + fi + ;; + esac +} + +_docker_container_exec() { + __docker_complete_detach_keys && return + + case "$prev" in + --env|-e) + # we do not append a "=" here because "-e VARNAME" is legal syntax, too + COMPREPLY=( $( compgen -e -- "$cur" ) ) + __docker_nospace + return + ;; + --user|-u) + __docker_complete_user_group + return + ;; + --workdir|-w) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--detach -d --detach-keys --env -e --help --interactive -i --privileged -t --tty -u --user --workdir -w" -- "$cur" ) ) + ;; + *) + __docker_complete_containers_running + ;; + esac +} + +_docker_container_export() { + case "$prev" in + --output|-o) + _filedir + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --output -o" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag) + if [ "$cword" -eq "$counter" ]; then + __docker_complete_containers_all + fi + ;; + esac +} + +_docker_container_inspect() { + _docker_inspect --type container +} + +_docker_container_kill() { + case "$prev" in + --signal|-s) + __docker_complete_signals + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --signal -s" -- "$cur" ) ) + ;; + *) + __docker_complete_containers_running + ;; + esac +} + +_docker_container_logs() { + case "$prev" in + --since|--tail|--until) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--details --follow -f --help --since --tail --timestamps -t --until" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag '--since|--tail|--until') + if [ "$cword" -eq "$counter" ]; then + __docker_complete_containers_all + fi + ;; + esac +} + +_docker_container_list() { + _docker_container_ls +} + +_docker_container_ls() { + local key=$(__docker_map_key_of_current_option '--filter|-f') + case "$key" in + ancestor) + __docker_complete_images --cur "${cur##*=}" --repo --tag --id + return + ;; + before) + __docker_complete_containers_all --cur "${cur##*=}" + return + ;; + expose|publish) + return + ;; + id) + __docker_complete_containers_all --cur "${cur##*=}" --id + return + ;; + health) + COMPREPLY=( $( compgen -W "healthy starting none unhealthy" -- "${cur##*=}" ) ) + return + ;; + is-task) + COMPREPLY=( $( compgen -W "true false" -- "${cur##*=}" ) ) + return + ;; + name) + __docker_complete_containers_all --cur "${cur##*=}" --name + return + ;; + network) + __docker_complete_networks --cur "${cur##*=}" + return + ;; + since) + __docker_complete_containers_all --cur "${cur##*=}" + return + ;; + status) + COMPREPLY=( $( compgen -W "created dead exited paused restarting running removing" -- "${cur##*=}" ) ) + return + ;; + volume) + __docker_complete_volumes --cur "${cur##*=}" + return + ;; + esac + + case "$prev" in + --filter|-f) + COMPREPLY=( $( compgen -S = -W "ancestor before exited expose health id is-task label name network publish since status volume" -- "$cur" ) ) + __docker_nospace + return + ;; + --format|--last|-n) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--all -a --filter -f --format --help --last -n --latest -l --no-trunc --quiet -q --size -s" -- "$cur" ) ) + ;; + esac +} + +_docker_container_pause() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + __docker_complete_containers_running + ;; + esac +} + +_docker_container_port() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag) + if [ "$cword" -eq "$counter" ]; then + __docker_complete_containers_all + fi + ;; + esac +} + +_docker_container_prune() { + case "$prev" in + --filter) + COMPREPLY=( $( compgen -W "label label! until" -S = -- "$cur" ) ) + __docker_nospace + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--force -f --filter --help" -- "$cur" ) ) + ;; + esac +} + +_docker_container_ps() { + _docker_container_ls +} + +_docker_container_rename() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag) + if [ "$cword" -eq "$counter" ]; then + __docker_complete_containers_all + fi + ;; + esac +} + +_docker_container_restart() { + case "$prev" in + --time|-t) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --time -t" -- "$cur" ) ) + ;; + *) + __docker_complete_containers_all + ;; + esac +} + +_docker_container_rm() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--force -f --help --link -l --volumes -v" -- "$cur" ) ) + ;; + *) + for arg in "${COMP_WORDS[@]}"; do + case "$arg" in + --force|-f) + __docker_complete_containers_all + return + ;; + esac + done + __docker_complete_containers_removable + ;; + esac +} + +_docker_container_run() { + _docker_container_run_and_create +} + +# _docker_container_run_and_create is the combined completion for `_docker_container_run` +# and `_docker_container_create` +_docker_container_run_and_create() { + local options_with_args=" + --add-host + --attach -a + --blkio-weight + --blkio-weight-device + --cap-add + --cap-drop + --cgroup-parent + --cidfile + --cpu-period + --cpu-quota + --cpu-rt-period + --cpu-rt-runtime + --cpuset-cpus + --cpus + --cpuset-mems + --cpu-shares -c + --device + --device-cgroup-rule + --device-read-bps + --device-read-iops + --device-write-bps + --device-write-iops + --dns + --dns-option + --dns-search + --domainname + --entrypoint + --env -e + --env-file + --expose + --group-add + --health-cmd + --health-interval + --health-retries + --health-start-period + --health-timeout + --hostname -h + --ip + --ip6 + --ipc + --kernel-memory + --label-file + --label -l + --link + --link-local-ip + --log-driver + --log-opt + --mac-address + --memory -m + --memory-swap + --memory-swappiness + --memory-reservation + --mount + --name + --network + --network-alias + --oom-score-adj + --pid + --pids-limit + --publish -p + --restart + --runtime + --security-opt + --shm-size + --stop-signal + --stop-timeout + --storage-opt + --tmpfs + --sysctl + --ulimit + --user -u + --userns + --uts + --volume-driver + --volumes-from + --volume -v + --workdir -w + " + __docker_server_os_is windows && options_with_args+=" + --cpu-count + --cpu-percent + --io-maxbandwidth + --io-maxiops + --isolation + " + __docker_server_is_experimental && options_with_args+=" + --platform + " + + local boolean_options=" + --disable-content-trust=false + --help + --init + --interactive -i + --no-healthcheck + --oom-kill-disable + --privileged + --publish-all -P + --read-only + --tty -t + " + + if [ "$command" = "run" ] || [ "$subcommand" = "run" ] ; then + options_with_args="$options_with_args + --detach-keys + " + boolean_options="$boolean_options + --detach -d + --rm + --sig-proxy=false + " + __docker_complete_detach_keys && return + fi + + local all_options="$options_with_args $boolean_options" + + + __docker_complete_log_driver_options && return + __docker_complete_restart && return + + local key=$(__docker_map_key_of_current_option '--security-opt') + case "$key" in + label) + [[ $cur == *: ]] && return + COMPREPLY=( $( compgen -W "user: role: type: level: disable" -- "${cur##*=}") ) + if [ "${COMPREPLY[*]}" != "disable" ] ; then + __docker_nospace + fi + return + ;; + seccomp) + local cur=${cur##*=} + _filedir + COMPREPLY+=( $( compgen -W "unconfined" -- "$cur" ) ) + return + ;; + esac + + case "$prev" in + --add-host) + case "$cur" in + *:) + __docker_complete_resolved_hostname + return + ;; + esac + ;; + --attach|-a) + COMPREPLY=( $( compgen -W 'stdin stdout stderr' -- "$cur" ) ) + return + ;; + --cap-add) + __docker_complete_capabilities_addable + return + ;; + --cap-drop) + __docker_complete_capabilities_droppable + return + ;; + --cidfile|--env-file|--label-file) + _filedir + return + ;; + --device|--tmpfs|--volume|-v) + case "$cur" in + *:*) + # TODO somehow do _filedir for stuff inside the image, if it's already specified (which is also somewhat difficult to determine) + ;; + '') + COMPREPLY=( $( compgen -W '/' -- "$cur" ) ) + __docker_nospace + ;; + /*) + _filedir + __docker_nospace + ;; + esac + return + ;; + --env|-e) + # we do not append a "=" here because "-e VARNAME" is legal syntax, too + COMPREPLY=( $( compgen -e -- "$cur" ) ) + __docker_nospace + return + ;; + --ipc) + case "$cur" in + *:*) + cur="${cur#*:}" + __docker_complete_containers_running + ;; + *) + COMPREPLY=( $( compgen -W 'none host private shareable container:' -- "$cur" ) ) + if [ "${COMPREPLY[*]}" = "container:" ]; then + __docker_nospace + fi + ;; + esac + return + ;; + --isolation) + if __docker_server_os_is windows ; then + __docker_complete_isolation + return + fi + ;; + --link) + case "$cur" in + *:*) + ;; + *) + __docker_complete_containers_running + COMPREPLY=( $( compgen -W "${COMPREPLY[*]}" -S ':' ) ) + __docker_nospace + ;; + esac + return + ;; + --log-driver) + __docker_complete_log_drivers + return + ;; + --log-opt) + __docker_complete_log_options + return + ;; + --network) + case "$cur" in + container:*) + __docker_complete_containers_all --cur "${cur#*:}" + ;; + *) + COMPREPLY=( $( compgen -W "$(__docker_plugins_bundled --type Network) $(__docker_networks) container:" -- "$cur") ) + if [ "${COMPREPLY[*]}" = "container:" ] ; then + __docker_nospace + fi + ;; + esac + return + ;; + --pid) + case "$cur" in + *:*) + __docker_complete_containers_running --cur "${cur#*:}" + ;; + *) + COMPREPLY=( $( compgen -W 'host container:' -- "$cur" ) ) + if [ "${COMPREPLY[*]}" = "container:" ]; then + __docker_nospace + fi + ;; + esac + return + ;; + --runtime) + __docker_complete_runtimes + return + ;; + --security-opt) + COMPREPLY=( $( compgen -W "apparmor= label= no-new-privileges seccomp= systempaths=unconfined" -- "$cur") ) + if [[ ${COMPREPLY[*]} = *= ]] ; then + __docker_nospace + fi + return + ;; + --stop-signal) + __docker_complete_signals + return + ;; + --storage-opt) + COMPREPLY=( $( compgen -W "size" -S = -- "$cur") ) + __docker_nospace + return + ;; + --user|-u) + __docker_complete_user_group + return + ;; + --userns) + COMPREPLY=( $( compgen -W "host" -- "$cur" ) ) + return + ;; + --volume-driver) + __docker_complete_plugins_bundled --type Volume + return + ;; + --volumes-from) + __docker_complete_containers_all + return + ;; + $(__docker_to_extglob "$options_with_args") ) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "$all_options" -- "$cur" ) ) + ;; + *) + local counter=$( __docker_pos_first_nonflag "$( __docker_to_alternatives "$options_with_args" )" ) + if [ "$cword" -eq "$counter" ]; then + __docker_complete_images --repo --tag --id + fi + ;; + esac +} + +_docker_container_start() { + __docker_complete_detach_keys && return + case "$prev" in + --checkpoint) + if __docker_server_is_experimental ; then + return + fi + ;; + --checkpoint-dir) + if __docker_server_is_experimental ; then + _filedir -d + return + fi + ;; + esac + + case "$cur" in + -*) + local options="--attach -a --detach-keys --help --interactive -i" + __docker_server_is_experimental && options+=" --checkpoint --checkpoint-dir" + COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + ;; + *) + __docker_complete_containers_stopped + ;; + esac +} + +_docker_container_stats() { + case "$prev" in + --format) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--all -a --format --help --no-stream --no-trunc" -- "$cur" ) ) + ;; + *) + __docker_complete_containers_running + ;; + esac +} + +_docker_container_stop() { + case "$prev" in + --time|-t) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --time -t" -- "$cur" ) ) + ;; + *) + __docker_complete_containers_stoppable + ;; + esac +} + +_docker_container_top() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag) + if [ "$cword" -eq "$counter" ]; then + __docker_complete_containers_running + fi + ;; + esac +} + +_docker_container_unpause() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag) + if [ "$cword" -eq "$counter" ]; then + __docker_complete_containers_unpauseable + fi + ;; + esac +} + +_docker_container_update() { + local options_with_args=" + --blkio-weight + --cpu-period + --cpu-quota + --cpu-rt-period + --cpu-rt-runtime + --cpus + --cpuset-cpus + --cpuset-mems + --cpu-shares -c + --kernel-memory + --memory -m + --memory-reservation + --memory-swap + --pids-limit + --restart + " + + local boolean_options=" + --help + " + + local all_options="$options_with_args $boolean_options" + + __docker_complete_restart && return + + case "$prev" in + $(__docker_to_extglob "$options_with_args") ) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "$all_options" -- "$cur" ) ) + ;; + *) + __docker_complete_containers_all + ;; + esac +} + +_docker_container_wait() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + __docker_complete_containers_all + ;; + esac +} + + +_docker_context() { + local subcommands=" + create + export + import + inspect + ls + rm + update + use + " + local aliases=" + list + remove + " + __docker_subcommands "$subcommands $aliases" && return + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) + ;; + esac +} + +_docker_context_create() { + case "$prev" in + --default-stack-orchestrator) + COMPREPLY=( $( compgen -W "all kubernetes swarm" -- "$cur" ) ) + return + ;; + --description|--docker|--kubernetes) + return + ;; + --from) + __docker_complete_contexts + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--default-stack-orchestrator --description --docker --from --help --kubernetes" -- "$cur" ) ) + ;; + esac +} + +_docker_context_export() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --kubeconfig" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag) + if [ "$cword" -eq "$counter" ]; then + __docker_complete_contexts + elif [ "$cword" -eq "$((counter + 1))" ]; then + _filedir + fi + ;; + esac +} + +_docker_context_import() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag) + if [ "$cword" -eq "$counter" ]; then + : + elif [ "$cword" -eq "$((counter + 1))" ]; then + _filedir + fi + ;; + esac +} + +_docker_context_inspect() { + case "$prev" in + --format|-f) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--format -f --help" -- "$cur" ) ) + ;; + *) + __docker_complete_contexts + ;; + esac +} + +_docker_context_list() { + _docker_context_ls +} + +_docker_context_ls() { + case "$prev" in + --format|-f) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--format -f --help --quiet -q" -- "$cur" ) ) + ;; + esac +} + +_docker_context_remove() { + _docker_context_rm +} + +_docker_context_rm() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--force -f --help" -- "$cur" ) ) + ;; + *) + __docker_complete_contexts + ;; + esac +} + +_docker_context_update() { + case "$prev" in + --default-stack-orchestrator) + COMPREPLY=( $( compgen -W "all kubernetes swarm" -- "$cur" ) ) + return + ;; + --description|--docker|--kubernetes) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--default-stack-orchestrator --description --docker --help --kubernetes" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag) + if [ "$cword" -eq "$counter" ]; then + __docker_complete_contexts + fi + ;; + esac +} + +_docker_context_use() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag) + if [ "$cword" -eq "$counter" ]; then + __docker_complete_contexts --add default + fi + ;; + esac +} + + +_docker_commit() { + _docker_container_commit +} + +_docker_cp() { + _docker_container_cp +} + +_docker_create() { + _docker_container_create +} + +_docker_daemon() { + local boolean_options=" + $global_boolean_options + --experimental + --help + --icc=false + --init + --ip-forward=false + --ip-masq=false + --iptables=false + --ipv6 + --live-restore + --no-new-privileges + --raw-logs + --selinux-enabled + --userland-proxy=false + --version -v + " + local options_with_args=" + $global_options_with_args + --add-runtime + --allow-nondistributable-artifacts + --api-cors-header + --authorization-plugin + --bip + --bridge -b + --cgroup-parent + --cluster-advertise + --cluster-store + --cluster-store-opt + --config-file + --containerd + --cpu-rt-period + --cpu-rt-runtime + --data-root + --default-address-pool + --default-gateway + --default-gateway-v6 + --default-runtime + --default-shm-size + --default-ulimit + --dns + --dns-search + --dns-opt + --exec-opt + --exec-root + --fixed-cidr + --fixed-cidr-v6 + --group -G + --init-path + --insecure-registry + --ip + --label + --log-driver + --log-opt + --max-concurrent-downloads + --max-concurrent-uploads + --metrics-addr + --mtu + --network-control-plane-mtu + --node-generic-resource + --oom-score-adjust + --pidfile -p + --registry-mirror + --seccomp-profile + --shutdown-timeout + --storage-driver -s + --storage-opt + --swarm-default-advertise-addr + --userland-proxy-path + --userns-remap + " + + __docker_complete_log_driver_options && return + + key=$(__docker_map_key_of_current_option '--cluster-store-opt') + case "$key" in + kv.*file) + cur=${cur##*=} + _filedir + return + ;; + esac + + local key=$(__docker_map_key_of_current_option '--storage-opt') + case "$key" in + dm.blkdiscard|dm.override_udev_sync_check|dm.use_deferred_removal|dm.use_deferred_deletion) + COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) ) + return + ;; + dm.directlvm_device|dm.thinpooldev) + cur=${cur##*=} + _filedir + return + ;; + dm.fs) + COMPREPLY=( $( compgen -W "ext4 xfs" -- "${cur##*=}" ) ) + return + ;; + dm.libdm_log_level) + COMPREPLY=( $( compgen -W "2 3 4 5 6 7" -- "${cur##*=}" ) ) + return + ;; + esac + + case "$prev" in + --authorization-plugin) + __docker_complete_plugins_bundled --type Authorization + return + ;; + --cluster-store) + COMPREPLY=( $( compgen -W "consul etcd zk" -S "://" -- "$cur" ) ) + __docker_nospace + return + ;; + --cluster-store-opt) + COMPREPLY=( $( compgen -W "discovery.heartbeat discovery.ttl kv.cacertfile kv.certfile kv.keyfile kv.path" -S = -- "$cur" ) ) + __docker_nospace + return + ;; + --config-file|--containerd|--init-path|--pidfile|-p|--tlscacert|--tlscert|--tlskey|--userland-proxy-path) + _filedir + return + ;; + --exec-root|--data-root) + _filedir -d + return + ;; + --log-driver) + __docker_complete_log_drivers + return + ;; + --storage-driver|-s) + COMPREPLY=( $( compgen -W "aufs btrfs overlay2 vfs zfs" -- "$(echo "$cur" | tr '[:upper:]' '[:lower:]')" ) ) + return + ;; + --storage-opt) + local btrfs_options="btrfs.min_space" + local overlay2_options="overlay2.size" + local zfs_options="zfs.fsname" + + local all_options="$btrfs_options $overlay2_options $zfs_options" + + case $(__docker_value_of_option '--storage-driver|-s') in + '') + COMPREPLY=( $( compgen -W "$all_options" -S = -- "$cur" ) ) + ;; + btrfs) + COMPREPLY=( $( compgen -W "$btrfs_options" -S = -- "$cur" ) ) + ;; + overlay2) + COMPREPLY=( $( compgen -W "$overlay2_options" -S = -- "$cur" ) ) + ;; + zfs) + COMPREPLY=( $( compgen -W "$zfs_options" -S = -- "$cur" ) ) + ;; + *) + return + ;; + esac + __docker_nospace + return + ;; + --log-level|-l) + __docker_complete_log_levels + return + ;; + --log-opt) + __docker_complete_log_options + return + ;; + --metrics-addr) + __docker_complete_local_ips + __docker_append_to_completions ":" + __docker_nospace + return + ;; + --seccomp-profile) + _filedir json + return + ;; + --swarm-default-advertise-addr) + __docker_complete_local_interfaces + return + ;; + --userns-remap) + __docker_complete_user_group + return + ;; + $(__docker_to_extglob "$options_with_args") ) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) ) + ;; + esac +} + +_docker_deploy() { + __docker_server_is_experimental && _docker_stack_deploy +} + +_docker_diff() { + _docker_container_diff +} + + +_docker_engine() { + local subcommands=" + activate + check + update + " + __docker_subcommands "$subcommands" && return + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) + ;; + esac +} + +_docker_engine_activate() { + case "$prev" in + --containerd|--engine-image|--format|--license|--registry-prefix|--version) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--containerd --display-only --engine-image --format --help --license --quiet --registry-prefix --version" -- "$cur" ) ) + ;; + esac +} + +_docker_engine_check() { + case "$prev" in + --containerd|--engine-image|--format|--registry-prefix) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--containerd --downgrades --engine-image --format --help --pre-releases --quiet -q --registry-prefix --upgrades" -- "$cur" ) ) + ;; + esac +} + +_docker_engine_update() { + case "$prev" in + --containerd|--engine-image|--registry-prefix|--version) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--containerd --engine-image --help --registry-prefix --version" -- "$cur" ) ) + ;; + esac +} + + +_docker_events() { + _docker_system_events +} + +_docker_exec() { + _docker_container_exec +} + +_docker_export() { + _docker_container_export +} + +_docker_help() { + local counter=$(__docker_pos_first_nonflag) + if [ "$cword" -eq "$counter" ]; then + COMPREPLY=( $( compgen -W "${commands[*]}" -- "$cur" ) ) + fi +} + +_docker_history() { + _docker_image_history +} + + +_docker_image() { + local subcommands=" + build + history + import + inspect + load + ls + prune + pull + push + rm + save + tag + " + local aliases=" + images + list + remove + rmi + " + __docker_subcommands "$subcommands $aliases" && return + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) + ;; + esac +} + +_docker_image_build() { + local options_with_args=" + --add-host + --build-arg + --cache-from + --cgroup-parent + --cpuset-cpus + --cpuset-mems + --cpu-shares -c + --cpu-period + --cpu-quota + --file -f + --iidfile + --label + --memory -m + --memory-swap + --network + --shm-size + --tag -t + --target + --ulimit + " + __docker_server_os_is windows && options_with_args+=" + --isolation + " + + local boolean_options=" + --disable-content-trust=false + --force-rm + --help + --no-cache + --pull + --quiet -q + --rm + " + + if __docker_server_is_experimental ; then + options_with_args+=" + --platform + " + boolean_options+=" + --squash + " + fi + + if [ "$DOCKER_BUILDKIT" = "1" ] ; then + options_with_args+=" + --output -o + --platform + --progress + --secret + --ssh + " + else + boolean_options+=" + --compress + " + if __docker_server_is_experimental ; then + boolean_options+=" + --stream + " + fi + fi + + local all_options="$options_with_args $boolean_options" + + case "$prev" in + --add-host) + case "$cur" in + *:) + __docker_complete_resolved_hostname + return + ;; + esac + ;; + --build-arg) + COMPREPLY=( $( compgen -e -- "$cur" ) ) + __docker_nospace + return + ;; + --cache-from) + __docker_complete_images --repo --tag --id + return + ;; + --file|-f|--iidfile) + _filedir + return + ;; + --isolation) + if __docker_server_os_is windows ; then + __docker_complete_isolation + return + fi + ;; + --network) + case "$cur" in + container:*) + __docker_complete_containers_all --cur "${cur#*:}" + ;; + *) + COMPREPLY=( $( compgen -W "$(__docker_plugins_bundled --type Network) $(__docker_networks) container:" -- "$cur") ) + if [ "${COMPREPLY[*]}" = "container:" ] ; then + __docker_nospace + fi + ;; + esac + return + ;; + --progress) + COMPREPLY=( $( compgen -W "auto plain tty" -- "$cur" ) ) + return + ;; + --tag|-t) + __docker_complete_images --repo --tag + return + ;; + --target) + local context_pos=$( __docker_pos_first_nonflag "$( __docker_to_alternatives "$options_with_args" )" ) + local context="${words[$context_pos]}" + context="${context:-.}" + + local file="$( __docker_value_of_option '--file|f' )" + local default_file="${context%/}/Dockerfile" + local dockerfile="${file:-$default_file}" + + local targets="$( sed -n 's/^FROM .\+ AS \(.\+\)/\1/p' "$dockerfile" 2>/dev/null )" + COMPREPLY=( $( compgen -W "$targets" -- "$cur" ) ) + return + ;; + $(__docker_to_extglob "$options_with_args") ) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "$all_options" -- "$cur" ) ) + ;; + *) + local counter=$( __docker_pos_first_nonflag "$( __docker_to_alternatives "$options_with_args" )" ) + if [ "$cword" -eq "$counter" ]; then + _filedir -d + fi + ;; + esac +} + +_docker_image_history() { + case "$prev" in + --format) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--format --help --human=false -H=false --no-trunc --quiet -q" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag '--format') + if [ "$cword" -eq "$counter" ]; then + __docker_complete_images --force-tag --id + fi + ;; + esac +} + +_docker_image_images() { + _docker_image_ls +} + +_docker_image_import() { + case "$prev" in + --change|-c|--message|-m|--platform) + return + ;; + esac + + case "$cur" in + -*) + local options="--change -c --help --message -m" + __docker_server_is_experimental && options+=" --platform" + COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag '--change|-c|--message|-m') + if [ "$cword" -eq "$counter" ]; then + _filedir + return + elif [ "$cword" -eq "$((counter + 1))" ]; then + __docker_complete_images --repo --tag + return + fi + ;; + esac +} + +_docker_image_inspect() { + _docker_inspect --type image +} + +_docker_image_load() { + case "$prev" in + --input|-i|"<") + _filedir + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --input -i --quiet -q" -- "$cur" ) ) + ;; + esac +} + +_docker_image_list() { + _docker_image_ls +} + +_docker_image_ls() { + local key=$(__docker_map_key_of_current_option '--filter|-f') + case "$key" in + before|since) + __docker_complete_images --cur "${cur##*=}" --force-tag --id + return + ;; + dangling) + COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) ) + return + ;; + label) + return + ;; + reference) + __docker_complete_images --cur "${cur##*=}" --repo --tag + return + ;; + esac + + case "$prev" in + --filter|-f) + COMPREPLY=( $( compgen -S = -W "before dangling label reference since" -- "$cur" ) ) + __docker_nospace + return + ;; + --format) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--all -a --digests --filter -f --format --help --no-trunc --quiet -q" -- "$cur" ) ) + ;; + =) + return + ;; + *) + __docker_complete_images --repo --tag + ;; + esac +} + +_docker_image_prune() { + case "$prev" in + --filter) + COMPREPLY=( $( compgen -W "label label! until" -S = -- "$cur" ) ) + __docker_nospace + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--all -a --force -f --filter --help" -- "$cur" ) ) + ;; + esac +} + +_docker_image_pull() { + case "$prev" in + --platform) + return + ;; + esac + + case "$cur" in + -*) + local options="--all-tags -a --disable-content-trust=false --help --quiet -q" + __docker_server_is_experimental && options+=" --platform" + + COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag --platform) + if [ "$cword" -eq "$counter" ]; then + for arg in "${COMP_WORDS[@]}"; do + case "$arg" in + --all-tags|-a) + __docker_complete_images --repo + return + ;; + esac + done + __docker_complete_images --repo --tag + fi + ;; + esac +} + +_docker_image_push() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--disable-content-trust=false --help" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag) + if [ "$cword" -eq "$counter" ]; then + __docker_complete_images --repo --tag + fi + ;; + esac +} + +_docker_image_remove() { + _docker_image_rm +} + +_docker_image_rm() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--force -f --help --no-prune" -- "$cur" ) ) + ;; + *) + __docker_complete_images --force-tag --id + ;; + esac +} + +_docker_image_rmi() { + _docker_image_rm +} + +_docker_image_save() { + case "$prev" in + --output|-o|">") + _filedir + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --output -o" -- "$cur" ) ) + ;; + *) + __docker_complete_images --repo --tag --id + ;; + esac +} + +_docker_image_tag() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag) + + if [ "$cword" -eq "$counter" ]; then + __docker_complete_images --force-tag --id + return + elif [ "$cword" -eq "$((counter + 1))" ]; then + __docker_complete_images --repo --tag + return + fi + ;; + esac +} + + +_docker_images() { + _docker_image_ls +} + +_docker_import() { + _docker_image_import +} + +_docker_info() { + _docker_system_info +} + +_docker_inspect() { + local preselected_type + local type + + if [ "$1" = "--type" ] ; then + preselected_type=yes + type="$2" + else + type=$(__docker_value_of_option --type) + fi + + case "$prev" in + --format|-f) + return + ;; + --type) + if [ -z "$preselected_type" ] ; then + COMPREPLY=( $( compgen -W "container image network node plugin secret service volume" -- "$cur" ) ) + return + fi + ;; + esac + + case "$cur" in + -*) + local options="--format -f --help --size -s" + if [ -z "$preselected_type" ] ; then + options+=" --type" + fi + COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + ;; + *) + case "$type" in + '') + COMPREPLY=( $( compgen -W " + $(__docker_containers --all) + $(__docker_images --force-tag --id) + $(__docker_networks) + $(__docker_nodes) + $(__docker_plugins_installed) + $(__docker_secrets) + $(__docker_services) + $(__docker_volumes) + " -- "$cur" ) ) + __ltrim_colon_completions "$cur" + ;; + container) + __docker_complete_containers_all + ;; + image) + __docker_complete_images --force-tag --id + ;; + network) + __docker_complete_networks + ;; + node) + __docker_complete_nodes + ;; + plugin) + __docker_complete_plugins_installed + ;; + secret) + __docker_complete_secrets + ;; + service) + __docker_complete_services + ;; + volume) + __docker_complete_volumes + ;; + esac + esac +} + +_docker_kill() { + _docker_container_kill +} + +_docker_load() { + _docker_image_load +} + +_docker_login() { + case "$prev" in + --password|-p|--username|-u) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --password -p --password-stdin --username -u" -- "$cur" ) ) + ;; + esac +} + +_docker_logout() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + esac +} + +_docker_logs() { + _docker_container_logs +} + +_docker_network_connect() { + local options_with_args=" + --alias + --ip + --ip6 + --link + --link-local-ip + " + + local boolean_options=" + --help + " + + case "$prev" in + --link) + case "$cur" in + *:*) + ;; + *) + __docker_complete_containers_running + COMPREPLY=( $( compgen -W "${COMPREPLY[*]}" -S ':' ) ) + __docker_nospace + ;; + esac + return + ;; + $(__docker_to_extglob "$options_with_args") ) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) ) + ;; + *) + local counter=$( __docker_pos_first_nonflag "$( __docker_to_alternatives "$options_with_args" )" ) + if [ "$cword" -eq "$counter" ]; then + __docker_complete_networks + elif [ "$cword" -eq "$((counter + 1))" ]; then + __docker_complete_containers_all + fi + ;; + esac +} + +_docker_network_create() { + case "$prev" in + --aux-address|--gateway|--ip-range|--ipam-opt|--ipv6|--opt|-o|--subnet) + return + ;; + --config-from) + __docker_complete_networks + return + ;; + --driver|-d) + # remove drivers that allow one instance only, add drivers missing in `docker info` + __docker_complete_plugins_bundled --type Network --remove host --remove null --add macvlan + return + ;; + --ipam-driver) + COMPREPLY=( $( compgen -W "default" -- "$cur" ) ) + return + ;; + --label) + return + ;; + --scope) + COMPREPLY=( $( compgen -W "local swarm" -- "$cur" ) ) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--attachable --aux-address --config-from --config-only --driver -d --gateway --help --ingress --internal --ip-range --ipam-driver --ipam-opt --ipv6 --label --opt -o --scope --subnet" -- "$cur" ) ) + ;; + esac +} + +_docker_network_disconnect() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag) + if [ "$cword" -eq "$counter" ]; then + __docker_complete_networks + elif [ "$cword" -eq "$((counter + 1))" ]; then + __docker_complete_containers_in_network "$prev" + fi + ;; + esac +} + +_docker_network_inspect() { + case "$prev" in + --format|-f) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--format -f --help --verbose" -- "$cur" ) ) + ;; + *) + __docker_complete_networks + esac +} + +_docker_network_ls() { + local key=$(__docker_map_key_of_current_option '--filter|-f') + case "$key" in + dangling) + COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) ) + return + ;; + driver) + __docker_complete_plugins_bundled --cur "${cur##*=}" --type Network --add macvlan + return + ;; + id) + __docker_complete_networks --cur "${cur##*=}" --id + return + ;; + name) + __docker_complete_networks --cur "${cur##*=}" --name + return + ;; + scope) + COMPREPLY=( $( compgen -W "global local swarm" -- "${cur##*=}" ) ) + return + ;; + type) + COMPREPLY=( $( compgen -W "builtin custom" -- "${cur##*=}" ) ) + return + ;; + esac + + case "$prev" in + --filter|-f) + COMPREPLY=( $( compgen -S = -W "dangling driver id label name scope type" -- "$cur" ) ) + __docker_nospace + return + ;; + --format) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--filter -f --format --help --no-trunc --quiet -q" -- "$cur" ) ) + ;; + esac +} + +_docker_network_prune() { + case "$prev" in + --filter) + COMPREPLY=( $( compgen -W "label label! until" -S = -- "$cur" ) ) + __docker_nospace + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--force -f --filter --help" -- "$cur" ) ) + ;; + esac +} + +_docker_network_rm() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + __docker_complete_networks --filter type=custom + esac +} + +_docker_network() { + local subcommands=" + connect + create + disconnect + inspect + ls + prune + rm + " + local aliases=" + list + remove + " + __docker_subcommands "$subcommands $aliases" && return + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) + ;; + esac +} + +_docker_service() { + local subcommands=" + create + inspect + logs + ls + rm + rollback + scale + ps + update + " + + local aliases=" + list + remove + " + __docker_subcommands "$subcommands $aliases" && return + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) + ;; + esac +} + +_docker_service_create() { + _docker_service_update_and_create +} + +_docker_service_inspect() { + case "$prev" in + --format|-f) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--format -f --help --pretty" -- "$cur" ) ) + ;; + *) + __docker_complete_services + esac +} + +_docker_service_logs() { + case "$prev" in + --since|--tail) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--details --follow -f --help --no-resolve --no-task-ids --no-trunc --raw --since --tail --timestamps -t" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag '--since|--tail') + if [ "$cword" -eq "$counter" ]; then + __docker_complete_services_and_tasks + fi + ;; + esac +} + +_docker_service_list() { + _docker_service_ls +} + +_docker_service_ls() { + local key=$(__docker_map_key_of_current_option '--filter|-f') + case "$key" in + id) + __docker_complete_services --cur "${cur##*=}" --id + return + ;; + mode) + COMPREPLY=( $( compgen -W "global replicated" -- "${cur##*=}" ) ) + return + ;; + name) + __docker_complete_services --cur "${cur##*=}" --name + return + ;; + esac + + case "$prev" in + --filter|-f) + COMPREPLY=( $( compgen -W "id label mode name" -S = -- "$cur" ) ) + __docker_nospace + return + ;; + --format) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--filter -f --format --help --quiet -q" -- "$cur" ) ) + ;; + esac +} + +_docker_service_remove() { + _docker_service_rm +} + +_docker_service_rm() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + __docker_complete_services + esac +} + +_docker_service_rollback() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--detach -d --help --quit -q" -- "$cur" ) ) + ;; + *) + local counter=$( __docker_pos_first_nonflag ) + if [ "$cword" -eq "$counter" ]; then + __docker_complete_services + fi + ;; + esac +} + +_docker_service_scale() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--detach -d --help" -- "$cur" ) ) + ;; + *) + __docker_complete_services + __docker_append_to_completions "=" + __docker_nospace + ;; + esac +} + +_docker_service_ps() { + local key=$(__docker_map_key_of_current_option '--filter|-f') + case "$key" in + desired-state) + COMPREPLY=( $( compgen -W "accepted running shutdown" -- "${cur##*=}" ) ) + return + ;; + name) + __docker_complete_services --cur "${cur##*=}" --name + return + ;; + node) + __docker_complete_nodes --cur "${cur##*=}" --add self + return + ;; + esac + + case "$prev" in + --filter|-f) + COMPREPLY=( $( compgen -W "desired-state id name node" -S = -- "$cur" ) ) + __docker_nospace + return + ;; + --format) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--filter -f --format --help --no-resolve --no-trunc --quiet -q" -- "$cur" ) ) + ;; + *) + __docker_complete_services + ;; + esac +} + +_docker_service_update() { + _docker_service_update_and_create +} + +# _docker_service_update_and_create is the combined completion for `docker service create` +# and `docker service update` +_docker_service_update_and_create() { + local options_with_args=" + --endpoint-mode + --entrypoint + --health-cmd + --health-interval + --health-retries + --health-start-period + --health-timeout + --hostname + --isolation + --limit-cpu + --limit-memory + --log-driver + --log-opt + --replicas + --replicas-max-per-node + --reserve-cpu + --reserve-memory + --restart-condition + --restart-delay + --restart-max-attempts + --restart-window + --rollback-delay + --rollback-failure-action + --rollback-max-failure-ratio + --rollback-monitor + --rollback-order + --rollback-parallelism + --stop-grace-period + --stop-signal + --update-delay + --update-failure-action + --update-max-failure-ratio + --update-monitor + --update-order + --update-parallelism + --user -u + --workdir -w + " + __docker_server_os_is windows && options_with_args+=" + --credential-spec + " + + local boolean_options=" + --detach -d + --help + --init + --no-healthcheck + --no-resolve-image + --read-only + --tty -t + --with-registry-auth + " + + __docker_complete_log_driver_options && return + + if [ "$subcommand" = "create" ] ; then + options_with_args="$options_with_args + --config + --constraint + --container-label + --dns + --dns-option + --dns-search + --env -e + --env-file + --generic-resource + --group + --host + --label -l + --mode + --mount + --name + --network + --placement-pref + --publish -p + --secret + --sysctl + " + + case "$prev" in + --env-file) + _filedir + return + ;; + --mode) + COMPREPLY=( $( compgen -W "global replicated" -- "$cur" ) ) + return + ;; + esac + fi + if [ "$subcommand" = "update" ] ; then + options_with_args="$options_with_args + --args + --config-add + --config-rm + --constraint-add + --constraint-rm + --container-label-add + --container-label-rm + --dns-add + --dns-option-add + --dns-option-rm + --dns-rm + --dns-search-add + --dns-search-rm + --env-add + --env-rm + --generic-resource-add + --generic-resource-rm + --group-add + --group-rm + --host-add + --host-rm + --image + --label-add + --label-rm + --mount-add + --mount-rm + --network-add + --network-rm + --placement-pref-add + --placement-pref-rm + --publish-add + --publish-rm + --rollback + --secret-add + --secret-rm + --sysctl-add + --sysctl-rm + " + + boolean_options="$boolean_options + --force + " + + case "$prev" in + --env-rm) + COMPREPLY=( $( compgen -e -- "$cur" ) ) + return + ;; + --image) + __docker_complete_images --repo --tag --id + return + ;; + esac + fi + + local strategy=$(__docker_map_key_of_current_option '--placement-pref|--placement-pref-add|--placement-pref-rm') + case "$strategy" in + spread) + COMPREPLY=( $( compgen -W "engine.labels node.labels" -S . -- "${cur##*=}" ) ) + __docker_nospace + return + ;; + esac + + case "$prev" in + --config|--config-add|--config-rm) + __docker_complete_configs + return + ;; + --endpoint-mode) + COMPREPLY=( $( compgen -W "dnsrr vip" -- "$cur" ) ) + return + ;; + --env|-e|--env-add) + # we do not append a "=" here because "-e VARNAME" is legal systax, too + COMPREPLY=( $( compgen -e -- "$cur" ) ) + __docker_nospace + return + ;; + --group|--group-add|--group-rm) + COMPREPLY=( $(compgen -g -- "$cur") ) + return + ;; + --host|--host-add|--host-rm) + case "$cur" in + *:) + __docker_complete_resolved_hostname + return + ;; + esac + ;; + --isolation) + __docker_complete_isolation + return + ;; + --log-driver) + __docker_complete_log_drivers + return + ;; + --log-opt) + __docker_complete_log_options + return + ;; + --network|--network-add|--network-rm) + __docker_complete_networks + return + ;; + --placement-pref|--placement-pref-add|--placement-pref-rm) + COMPREPLY=( $( compgen -W "spread" -S = -- "$cur" ) ) + __docker_nospace + return + ;; + --restart-condition) + COMPREPLY=( $( compgen -W "any none on-failure" -- "$cur" ) ) + return + ;; + --rollback-failure-action) + COMPREPLY=( $( compgen -W "continue pause" -- "$cur" ) ) + return + ;; + --secret|--secret-add|--secret-rm) + __docker_complete_secrets + return + ;; + --stop-signal) + __docker_complete_signals + return + ;; + --update-failure-action) + COMPREPLY=( $( compgen -W "continue pause rollback" -- "$cur" ) ) + return + ;; + --update-order|--rollback-order) + COMPREPLY=( $( compgen -W "start-first stop-first" -- "$cur" ) ) + return + ;; + --user|-u) + __docker_complete_user_group + return + ;; + $(__docker_to_extglob "$options_with_args") ) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) ) + ;; + *) + local counter=$( __docker_pos_first_nonflag "$( __docker_to_alternatives "$options_with_args" )" ) + if [ "$subcommand" = "update" ] ; then + if [ "$cword" -eq "$counter" ]; then + __docker_complete_services + fi + else + if [ "$cword" -eq "$counter" ]; then + __docker_complete_images --repo --tag --id + fi + fi + ;; + esac +} + +_docker_swarm() { + local subcommands=" + ca + init + join + join-token + leave + unlock + unlock-key + update + " + __docker_subcommands "$subcommands" && return + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) + ;; + esac +} + +_docker_swarm_ca() { + case "$prev" in + --ca-cert|--ca-key) + _filedir + return + ;; + --cert-expiry|--external-ca) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--ca-cert --ca-key --cert-expiry --detach -d --external-ca --help --quiet -q --rotate" -- "$cur" ) ) + ;; + esac +} + +_docker_swarm_init() { + case "$prev" in + --advertise-addr) + if [[ $cur == *: ]] ; then + COMPREPLY=( $( compgen -W "2377" -- "${cur##*:}" ) ) + else + __docker_complete_local_interfaces + __docker_nospace + fi + return + ;; + --availability) + COMPREPLY=( $( compgen -W "active drain pause" -- "$cur" ) ) + return + ;; + --cert-expiry|--data-path-port|--default-addr-pool|--default-addr-pool-mask-length|--dispatcher-heartbeat|--external-ca|--max-snapshots|--snapshot-interval|--task-history-limit ) + return + ;; + --data-path-addr) + __docker_complete_local_interfaces + return + ;; + --listen-addr) + if [[ $cur == *: ]] ; then + COMPREPLY=( $( compgen -W "2377" -- "${cur##*:}" ) ) + else + __docker_complete_local_interfaces --add 0.0.0.0 + __docker_nospace + fi + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--advertise-addr --autolock --availability --cert-expiry --data-path-addr --data-path-port --default-addr-pool --default-addr-pool-mask-length --dispatcher-heartbeat --external-ca --force-new-cluster --help --listen-addr --max-snapshots --snapshot-interval --task-history-limit " -- "$cur" ) ) + ;; + esac +} + +_docker_swarm_join() { + case "$prev" in + --advertise-addr) + if [[ $cur == *: ]] ; then + COMPREPLY=( $( compgen -W "2377" -- "${cur##*:}" ) ) + else + __docker_complete_local_interfaces + __docker_nospace + fi + return + ;; + --availability) + COMPREPLY=( $( compgen -W "active drain pause" -- "$cur" ) ) + return + ;; + --data-path-addr) + __docker_complete_local_interfaces + return + ;; + --listen-addr) + if [[ $cur == *: ]] ; then + COMPREPLY=( $( compgen -W "2377" -- "${cur##*:}" ) ) + else + __docker_complete_local_interfaces --add 0.0.0.0 + __docker_nospace + fi + return + ;; + --token) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--advertise-addr --availability --data-path-addr --help --listen-addr --token" -- "$cur" ) ) + ;; + *:) + COMPREPLY=( $( compgen -W "2377" -- "${cur##*:}" ) ) + ;; + esac +} + +_docker_swarm_join_token() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --quiet -q --rotate" -- "$cur" ) ) + ;; + *) + local counter=$( __docker_pos_first_nonflag ) + if [ "$cword" -eq "$counter" ]; then + COMPREPLY=( $( compgen -W "manager worker" -- "$cur" ) ) + fi + ;; + esac +} + +_docker_swarm_leave() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--force -f --help" -- "$cur" ) ) + ;; + esac +} + +_docker_swarm_unlock() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + esac +} + +_docker_swarm_unlock_key() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --quiet -q --rotate" -- "$cur" ) ) + ;; + esac +} + +_docker_swarm_update() { + case "$prev" in + --cert-expiry|--dispatcher-heartbeat|--external-ca|--max-snapshots|--snapshot-interval|--task-history-limit) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--autolock --cert-expiry --dispatcher-heartbeat --external-ca --help --max-snapshots --snapshot-interval --task-history-limit" -- "$cur" ) ) + ;; + esac +} + +_docker_manifest() { + local subcommands=" + annotate + create + inspect + push + " + __docker_subcommands "$subcommands" && return + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) + ;; + esac +} + +_docker_manifest_annotate() { + case "$prev" in + --arch) + COMPREPLY=( $( compgen -W " + 386 + amd64 + arm + arm64 + mips64 + mips64le + ppc64le + s390x" -- "$cur" ) ) + return + ;; + --os) + COMPREPLY=( $( compgen -W " + darwin + dragonfly + freebsd + linux + netbsd + openbsd + plan9 + solaris + windows" -- "$cur" ) ) + return + ;; + --os-features|--variant) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--arch --help --os --os-features --variant" -- "$cur" ) ) + ;; + *) + local counter=$( __docker_pos_first_nonflag "--arch|--os|--os-features|--variant" ) + if [ "$cword" -eq "$counter" ] || [ "$cword" -eq "$((counter + 1))" ]; then + __docker_complete_images --force-tag --id + fi + ;; + esac +} + +_docker_manifest_create() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--amend -a --help --insecure" -- "$cur" ) ) + ;; + *) + __docker_complete_images --force-tag --id + ;; + esac +} + +_docker_manifest_inspect() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --insecure --verbose -v" -- "$cur" ) ) + ;; + *) + local counter=$( __docker_pos_first_nonflag ) + if [ "$cword" -eq "$counter" ] || [ "$cword" -eq "$((counter + 1))" ]; then + __docker_complete_images --force-tag --id + fi + ;; + esac +} + +_docker_manifest_push() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --insecure --purge -p" -- "$cur" ) ) + ;; + *) + local counter=$( __docker_pos_first_nonflag ) + if [ "$cword" -eq "$counter" ]; then + __docker_complete_images --force-tag --id + fi + ;; + esac +} + +_docker_node() { + local subcommands=" + demote + inspect + ls + promote + rm + ps + update + " + local aliases=" + list + remove + " + __docker_subcommands "$subcommands $aliases" && return + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) + ;; + esac +} + +_docker_node_demote() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + __docker_complete_nodes --filter role=manager + esac +} + +_docker_node_inspect() { + case "$prev" in + --format|-f) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--format -f --help --pretty" -- "$cur" ) ) + ;; + *) + __docker_complete_nodes --add self + esac +} + +_docker_node_list() { + _docker_node_ls +} + +_docker_node_ls() { + local key=$(__docker_map_key_of_current_option '--filter|-f') + case "$key" in + id) + __docker_complete_nodes --cur "${cur##*=}" --id + return + ;; + membership) + COMPREPLY=( $( compgen -W "accepted pending" -- "${cur##*=}" ) ) + return + ;; + name) + __docker_complete_nodes --cur "${cur##*=}" --name + return + ;; + role) + COMPREPLY=( $( compgen -W "manager worker" -- "${cur##*=}" ) ) + return + ;; + esac + + case "$prev" in + --filter|-f) + COMPREPLY=( $( compgen -W "id label membership name role" -S = -- "$cur" ) ) + __docker_nospace + return + ;; + --format) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--filter -f --format --help --quiet -q" -- "$cur" ) ) + ;; + esac +} + +_docker_node_promote() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + __docker_complete_nodes --filter role=worker + esac +} + +_docker_node_remove() { + _docker_node_rm +} + +_docker_node_rm() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--force -f --help" -- "$cur" ) ) + ;; + *) + __docker_complete_nodes + esac +} + +_docker_node_ps() { + local key=$(__docker_map_key_of_current_option '--filter|-f') + case "$key" in + desired-state) + COMPREPLY=( $( compgen -W "accepted running shutdown" -- "${cur##*=}" ) ) + return + ;; + name) + __docker_complete_services --cur "${cur##*=}" --name + return + ;; + esac + + case "$prev" in + --filter|-f) + COMPREPLY=( $( compgen -W "desired-state id label name" -S = -- "$cur" ) ) + __docker_nospace + return + ;; + --format) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--filter -f --format --help --no-resolve --no-trunc --quiet -q" -- "$cur" ) ) + ;; + *) + __docker_complete_nodes --add self + ;; + esac +} + +_docker_node_update() { + case "$prev" in + --availability) + COMPREPLY=( $( compgen -W "active drain pause" -- "$cur" ) ) + return + ;; + --role) + COMPREPLY=( $( compgen -W "manager worker" -- "$cur" ) ) + return + ;; + --label-add|--label-rm) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--availability --help --label-add --label-rm --role" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag '--availability|--label-add|--label-rm|--role') + if [ "$cword" -eq "$counter" ]; then + __docker_complete_nodes + fi + ;; + esac +} + +_docker_pause() { + _docker_container_pause +} + +_docker_plugin() { + local subcommands=" + create + disable + enable + inspect + install + ls + push + rm + set + upgrade + " + local aliases=" + list + remove + " + __docker_subcommands "$subcommands $aliases" && return + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) + ;; + esac +} + +_docker_plugin_create() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--compress --help" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag) + if [ "$cword" -eq "$counter" ]; then + # reponame + return + elif [ "$cword" -eq "$((counter + 1))" ]; then + _filedir -d + fi + ;; + esac +} + +_docker_plugin_disable() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--force -f --help" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag) + if [ "$cword" -eq "$counter" ]; then + __docker_complete_plugins_installed --filter enabled=true + fi + ;; + esac +} + +_docker_plugin_enable() { + case "$prev" in + --timeout) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --timeout" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag '--timeout') + if [ "$cword" -eq "$counter" ]; then + __docker_complete_plugins_installed --filter enabled=false + fi + ;; + esac +} + +_docker_plugin_inspect() { + case "$prev" in + --format|f) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--format -f --help" -- "$cur" ) ) + ;; + *) + __docker_complete_plugins_installed + ;; + esac +} + +_docker_plugin_install() { + case "$prev" in + --alias) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--alias --disable --disable-content-trust=false --grant-all-permissions --help" -- "$cur" ) ) + ;; + esac +} + +_docker_plugin_list() { + _docker_plugin_ls +} + +_docker_plugin_ls() { + local key=$(__docker_map_key_of_current_option '--filter|-f') + case "$key" in + capability) + COMPREPLY=( $( compgen -W "authz ipamdriver logdriver metricscollector networkdriver volumedriver" -- "${cur##*=}" ) ) + return + ;; + enabled) + COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) ) + return + ;; + esac + + case "$prev" in + --filter|-f) + COMPREPLY=( $( compgen -S = -W "capability enabled" -- "$cur" ) ) + __docker_nospace + return + ;; + --format) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--filter -f --format --help --no-trunc --quiet -q" -- "$cur" ) ) + ;; + esac +} + +_docker_plugin_push() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag) + if [ "$cword" -eq "$counter" ]; then + __docker_complete_plugins_installed + fi + ;; + esac +} + +_docker_plugin_remove() { + _docker_plugin_rm +} + +_docker_plugin_rm() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--force -f --help" -- "$cur" ) ) + ;; + *) + __docker_complete_plugins_installed + ;; + esac +} + +_docker_plugin_set() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag) + if [ "$cword" -eq "$counter" ]; then + __docker_complete_plugins_installed + fi + ;; + esac +} + +_docker_plugin_upgrade() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--disable-content-trust --grant-all-permissions --help --skip-remote-check" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag) + if [ "$cword" -eq "$counter" ]; then + __docker_complete_plugins_installed + __ltrim_colon_completions "$cur" + elif [ "$cword" -eq "$((counter + 1))" ]; then + local plugin_images="$(__docker_plugins_installed)" + COMPREPLY=( $(compgen -S : -W "${plugin_images%:*}" -- "$cur") ) + __docker_nospace + fi + ;; + esac +} + + +_docker_port() { + _docker_container_port +} + +_docker_ps() { + _docker_container_ls +} + +_docker_pull() { + _docker_image_pull +} + +_docker_push() { + _docker_image_push +} + +_docker_rename() { + _docker_container_rename +} + +_docker_restart() { + _docker_container_restart +} + +_docker_rm() { + _docker_container_rm +} + +_docker_rmi() { + _docker_image_rm +} + +_docker_run() { + _docker_container_run +} + +_docker_save() { + _docker_image_save +} + + +_docker_secret() { + local subcommands=" + create + inspect + ls + rm + " + local aliases=" + list + remove + " + __docker_subcommands "$subcommands $aliases" && return + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) + ;; + esac +} + +_docker_secret_create() { + case "$prev" in + --driver|-d|--label|-l) + return + ;; + --template-driver) + COMPREPLY=( $( compgen -W "golang" -- "$cur" ) ) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--driver -d --help --label -l --template-driver" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag '--driver|-d|--label|-l|--template-driver') + if [ "$cword" -eq "$((counter + 1))" ]; then + _filedir + fi + ;; + esac +} + +_docker_secret_inspect() { + case "$prev" in + --format|-f) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--format -f --help --pretty" -- "$cur" ) ) + ;; + *) + __docker_complete_secrets + ;; + esac +} + +_docker_secret_list() { + _docker_secret_ls +} + +_docker_secret_ls() { + local key=$(__docker_map_key_of_current_option '--filter|-f') + case "$key" in + id) + __docker_complete_secrets --cur "${cur##*=}" --id + return + ;; + name) + __docker_complete_secrets --cur "${cur##*=}" --name + return + ;; + esac + + case "$prev" in + --filter|-f) + COMPREPLY=( $( compgen -S = -W "id label name" -- "$cur" ) ) + __docker_nospace + return + ;; + --format) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--format --filter -f --help --quiet -q" -- "$cur" ) ) + ;; + esac +} + +_docker_secret_remove() { + _docker_secret_rm +} + +_docker_secret_rm() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + __docker_complete_secrets + ;; + esac +} + + + +_docker_search() { + local key=$(__docker_map_key_of_current_option '--filter|-f') + case "$key" in + is-automated) + COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) ) + return + ;; + is-official) + COMPREPLY=( $( compgen -W "false true" -- "${cur##*=}" ) ) + return + ;; + esac + + case "$prev" in + --filter|-f) + COMPREPLY=( $( compgen -S = -W "is-automated is-official stars" -- "$cur" ) ) + __docker_nospace + return + ;; + --format|--limit) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--filter -f --format --help --limit --no-trunc" -- "$cur" ) ) + ;; + esac +} + + +_docker_stack() { + local subcommands=" + deploy + ls + ps + rm + services + " + local aliases=" + down + list + remove + up + " + + __docker_complete_stack_orchestrator_options && return + __docker_subcommands "$subcommands $aliases" && return + + case "$cur" in + -*) + local options="--help --orchestrator" + __docker_stack_orchestrator_is kubernetes && options+=" --kubeconfig" + COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) + ;; + esac +} + +_docker_stack_deploy() { + __docker_complete_stack_orchestrator_options && return + + case "$prev" in + --bundle-file) + _filedir dab + return + ;; + --compose-file|-c) + _filedir yml + return + ;; + --resolve-image) + COMPREPLY=( $( compgen -W "always changed never" -- "$cur" ) ) + return + ;; + esac + + case "$cur" in + -*) + local options="--compose-file -c --help --orchestrator" + __docker_server_is_experimental && __docker_stack_orchestrator_is swarm && options+=" --bundle-file" + __docker_stack_orchestrator_is kubernetes && options+=" --kubeconfig --namespace" + __docker_stack_orchestrator_is swarm && options+=" --prune --resolve-image --with-registry-auth" + COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag '--bundle-file|--compose-file|-c|--kubeconfig|--namespace|--orchestrator|--resolve-image') + if [ "$cword" -eq "$counter" ]; then + __docker_complete_stacks + fi + ;; + esac +} + +_docker_stack_down() { + _docker_stack_rm +} + +_docker_stack_list() { + _docker_stack_ls +} + +_docker_stack_ls() { + __docker_complete_stack_orchestrator_options && return + + case "$prev" in + --format) + return + ;; + esac + + case "$cur" in + -*) + local options="--format --help --orchestrator" + __docker_stack_orchestrator_is kubernetes && options+=" --all-namespaces --kubeconfig --namespace" + COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + ;; + esac +} + +_docker_stack_ps() { + local key=$(__docker_map_key_of_current_option '--filter|-f') + case "$key" in + desired-state) + COMPREPLY=( $( compgen -W "accepted running shutdown" -- "${cur##*=}" ) ) + return + ;; + id) + __docker_complete_stacks --cur "${cur##*=}" --id + return + ;; + name) + __docker_complete_stacks --cur "${cur##*=}" --name + return + ;; + esac + + __docker_complete_stack_orchestrator_options && return + + case "$prev" in + --filter|-f) + COMPREPLY=( $( compgen -S = -W "id name desired-state" -- "$cur" ) ) + __docker_nospace + return + ;; + --format) + return + ;; + esac + + case "$cur" in + -*) + local options="--filter -f --format --help --no-resolve --no-trunc --orchestrator --quiet -q" + __docker_stack_orchestrator_is kubernetes && options+=" --all-namespaces --kubeconfig --namespace" + COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag '--all-namespaces|--filter|-f|--format|--kubeconfig|--namespace') + if [ "$cword" -eq "$counter" ]; then + __docker_complete_stacks + fi + ;; + esac +} + +_docker_stack_remove() { + _docker_stack_rm +} + +_docker_stack_rm() { + __docker_complete_stack_orchestrator_options && return + + case "$cur" in + -*) + local options="--help --orchestrator" + __docker_stack_orchestrator_is kubernetes && options+=" --kubeconfig --namespace" + COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + ;; + *) + __docker_complete_stacks + ;; + esac +} + +_docker_stack_services() { + local key=$(__docker_map_key_of_current_option '--filter|-f') + case "$key" in + id) + __docker_complete_services --cur "${cur##*=}" --id + return + ;; + label) + return + ;; + name) + __docker_complete_services --cur "${cur##*=}" --name + return + ;; + esac + + __docker_complete_stack_orchestrator_options && return + + case "$prev" in + --filter|-f) + COMPREPLY=( $( compgen -S = -W "id label name" -- "$cur" ) ) + __docker_nospace + return + ;; + --format) + return + ;; + esac + + case "$cur" in + -*) + local options="--filter -f --format --help --orchestrator --quiet -q" + __docker_stack_orchestrator_is kubernetes && options+=" --kubeconfig --namespace" + COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag '--filter|-f|--format|--kubeconfig|--namespace|--orchestrator') + if [ "$cword" -eq "$counter" ]; then + __docker_complete_stacks + fi + ;; + esac +} + +_docker_stack_up() { + _docker_stack_deploy +} + + +_docker_start() { + _docker_container_start +} + +_docker_stats() { + _docker_container_stats +} + +_docker_stop() { + _docker_container_stop +} + + +_docker_system() { + local subcommands=" + df + events + info + prune + " + __docker_subcommands "$subcommands" && return + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) + ;; + esac +} + +_docker_system_df() { + case "$prev" in + --format) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--format --help --verbose -v" -- "$cur" ) ) + ;; + esac +} + +_docker_system_events() { + local key=$(__docker_map_key_of_current_option '-f|--filter') + case "$key" in + container) + __docker_complete_containers_all --cur "${cur##*=}" + return + ;; + daemon) + local name=$(__docker_q info | sed -n 's/^\(ID\|Name\): //p') + COMPREPLY=( $( compgen -W "$name" -- "${cur##*=}" ) ) + return + ;; + event) + COMPREPLY=( $( compgen -W " + attach + commit + connect + copy + create + delete + destroy + detach + die + disable + disconnect + enable + exec_create + exec_detach + exec_die + exec_start + export + health_status + import + install + kill + load + mount + oom + pause + pull + push + reload + remove + rename + resize + restart + save + start + stop + tag + top + unmount + unpause + untag + update + " -- "${cur##*=}" ) ) + return + ;; + image) + __docker_complete_images --cur "${cur##*=}" --repo --tag + return + ;; + network) + __docker_complete_networks --cur "${cur##*=}" + return + ;; + node) + __docker_complete_nodes --cur "${cur##*=}" + return + ;; + scope) + COMPREPLY=( $( compgen -W "local swarm" -- "${cur##*=}" ) ) + return + ;; + type) + COMPREPLY=( $( compgen -W "config container daemon image network node plugin secret service volume" -- "${cur##*=}" ) ) + return + ;; + volume) + __docker_complete_volumes --cur "${cur##*=}" + return + ;; + esac + + case "$prev" in + --filter|-f) + COMPREPLY=( $( compgen -S = -W "container daemon event image label network node scope type volume" -- "$cur" ) ) + __docker_nospace + return + ;; + --since|--until) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--filter -f --help --since --until --format" -- "$cur" ) ) + ;; + esac +} + +_docker_system_info() { + case "$prev" in + --format|-f) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--format -f --help" -- "$cur" ) ) + ;; + esac +} + +_docker_system_prune() { + case "$prev" in + --filter) + COMPREPLY=( $( compgen -W "label label! until" -S = -- "$cur" ) ) + __docker_nospace + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--all -a --force -f --filter --help --volumes" -- "$cur" ) ) + ;; + esac +} + + +_docker_tag() { + _docker_image_tag +} + + +_docker_trust() { + local subcommands=" + inspect + revoke + sign + " + __docker_subcommands "$subcommands" && return + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) + ;; + esac +} + +_docker_trust_inspect() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --pretty" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag) + if [ "$cword" -eq "$counter" ]; then + __docker_complete_images --repo --tag + fi + ;; + esac +} + +_docker_trust_revoke() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --yes -y" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag) + if [ "$cword" -eq "$counter" ]; then + __docker_complete_images --repo --tag + fi + ;; + esac +} + +_docker_trust_sign() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --local" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag) + if [ "$cword" -eq "$counter" ]; then + __docker_complete_images --force-tag --id + fi + ;; + esac +} + + +_docker_unpause() { + _docker_container_unpause +} + +_docker_update() { + _docker_container_update +} + +_docker_top() { + _docker_container_top +} + +_docker_version() { + __docker_complete_stack_orchestrator_options && return + + case "$prev" in + --format|-f) + return + ;; + esac + + case "$cur" in + -*) + local options="--format -f --help" + __docker_stack_orchestrator_is kubernetes && options+=" --kubeconfig" + COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) + ;; + esac +} + +_docker_volume_create() { + case "$prev" in + --driver|-d) + __docker_complete_plugins_bundled --type Volume + return + ;; + --label|--opt|-o) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--driver -d --help --label --opt -o" -- "$cur" ) ) + ;; + esac +} + +_docker_volume_inspect() { + case "$prev" in + --format|-f) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--format -f --help" -- "$cur" ) ) + ;; + *) + __docker_complete_volumes + ;; + esac +} + +_docker_volume_list() { + _docker_volume_ls +} + +_docker_volume_ls() { + local key=$(__docker_map_key_of_current_option '--filter|-f') + case "$key" in + dangling) + COMPREPLY=( $( compgen -W "true false" -- "${cur##*=}" ) ) + return + ;; + driver) + __docker_complete_plugins_bundled --cur "${cur##*=}" --type Volume + return + ;; + name) + __docker_complete_volumes --cur "${cur##*=}" + return + ;; + esac + + case "$prev" in + --filter|-f) + COMPREPLY=( $( compgen -S = -W "dangling driver label name" -- "$cur" ) ) + __docker_nospace + return + ;; + --format) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--filter -f --format --help --quiet -q" -- "$cur" ) ) + ;; + esac +} + +_docker_volume_prune() { + case "$prev" in + --filter) + COMPREPLY=( $( compgen -W "label label!" -S = -- "$cur" ) ) + __docker_nospace + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--filter --force -f --help" -- "$cur" ) ) + ;; + esac +} + +_docker_volume_remove() { + _docker_volume_rm +} + +_docker_volume_rm() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--force -f --help" -- "$cur" ) ) + ;; + *) + __docker_complete_volumes + ;; + esac +} + +_docker_volume() { + local subcommands=" + create + inspect + ls + prune + rm + " + local aliases=" + list + remove + " + __docker_subcommands "$subcommands $aliases" && return + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) + ;; + esac +} + +_docker_wait() { + _docker_container_wait +} + +_docker() { + local previous_extglob_setting=$(shopt -p extglob) + shopt -s extglob + + local management_commands=( + builder + config + container + context + engine + image + network + node + plugin + secret + service + stack + swarm + system + trust + volume + ) + + local top_level_commands=( + build + login + logout + run + search + version + ) + + local legacy_commands=( + attach + commit + cp + create + diff + events + exec + export + history + images + import + info + inspect + kill + load + logs + pause + port + ps + pull + push + rename + restart + rm + rmi + save + start + stats + stop + tag + top + unpause + update + wait + ) + + local experimental_client_commands=( + manifest + ) + + local experimental_server_commands=( + checkpoint + deploy + ) + + local commands=(${management_commands[*]} ${top_level_commands[*]}) + [ -z "$DOCKER_HIDE_LEGACY_COMMANDS" ] && commands+=(${legacy_commands[*]}) + + # These options are valid as global options for all client commands + # and valid as command options for `docker daemon` + local global_boolean_options=" + --debug -D + --tls + --tlsverify + " + local global_options_with_args=" + --config + --context -c + --host -H + --log-level -l + --tlscacert + --tlscert + --tlskey + " + + # variables to cache server info, populated on demand for performance reasons + local info_fetched server_experimental server_os + # variables to cache client info, populated on demand for performance reasons + local client_experimental stack_orchestrator_is_kubernetes stack_orchestrator_is_swarm + + local host config context + + COMPREPLY=() + local cur prev words cword + _get_comp_words_by_ref -n : cur prev words cword + + local command='docker' command_pos=0 subcommand_pos + local counter=1 + while [ "$counter" -lt "$cword" ]; do + case "${words[$counter]}" in + docker) + return 0 + ;; + # save host so that completion can use custom daemon + --host|-H) + (( counter++ )) + host="${words[$counter]}" + ;; + # save config so that completion can use custom configuration directories + --config) + (( counter++ )) + config="${words[$counter]}" + ;; + # save context so that completion can use custom daemon + --context|-c) + (( counter++ )) + context="${words[$counter]}" + ;; + $(__docker_to_extglob "$global_options_with_args") ) + (( counter++ )) + ;; + -*) + ;; + =) + (( counter++ )) + ;; + *) + command="${words[$counter]}" + command_pos=$counter + break + ;; + esac + (( counter++ )) + done + + local binary="${words[0]}" + if [[ $binary == ?(*/)dockerd ]] ; then + # for the dockerd binary, we reuse completion of `docker daemon`. + # dockerd does not have subcommands and global options. + command=daemon + command_pos=0 + fi + + local completions_func=_docker_${command//-/_} + declare -F $completions_func >/dev/null && $completions_func + + eval "$previous_extglob_setting" + return 0 +} + +eval "$__docker_previous_extglob_setting" +unset __docker_previous_extglob_setting + +complete -F _docker d docker docker.exe dockerd dockerd.exe diff --git a/docker/setup b/docker/setup new file mode 100755 index 0000000..b33e8eb --- /dev/null +++ b/docker/setup @@ -0,0 +1,3 @@ +#!/bin/sh +mkdir -p ~/.local/share/docker +ln -fs "$PWD/completion" ~/.local/share/docker/completion diff --git a/gh/config.yml b/gh/config.yml new file mode 100644 index 0000000..a0114ba --- /dev/null +++ b/gh/config.yml @@ -0,0 +1,41 @@ +git_protocol: ssh +editor: vim +prompt: enabled +pager: less +aliases: + co: pr checkout + del: | + !gh api -X DELETE "repos/$GITUSER/$1" + priv: | + !gh api -X PATCH "repos/$GITUSER/$1" -f private="true" | jq .private + pub: | + !gh api -X PATCH "repos/$GITUSER/$1" -f private="false" | jq .private + status: | + !gh api graphql -f emoji="${1%% *}" -f msg="${1#* }" -f query='mutation ($msg: String!, $emoji: String) {changeUserStatus(input:{message:$msg,emoji:$emoji}) {status { message, emoji }}}' + repos: | + !gh api --paginate graphql -f owner="$1" -f query=' + query($owner: String!, $per_page: Int = 100, $endCursor: String) { + repositoryOwner(login: $owner) { + repositories(first: $per_page, after: $endCursor, ownerAffiliations: OWNER) { + nodes { nameWithOwner } + pageInfo { hasNextPage endCursor } + } + } + } + ' | jq -r '.data.repositoryOwner.repositories.nodes[].nameWithOwner' | sort + orgs: | + !gh api --paginate graphql -f query=' + query { + viewer { + id + name + organizations(first: 100) { + nodes { + id + name + } + } + } + } ' | jq -r '.data.viewer.organizations[][] | .id + " " + .name' + defmain: | + !gh api -X PATCH "repos/$1" -f default_branch="main" | jq .default_branch diff --git a/gh/setup b/gh/setup new file mode 100755 index 0000000..1cfe00f --- /dev/null +++ b/gh/setup @@ -0,0 +1,5 @@ +#!/bin/sh +mkdir -p ~/.config/gh 2>/dev/null +ln -fs "$PWD/config.yml" "$HOME/.config/gh/config.yml" +ls -l ~/.config/gh +echo 'You might need to do gh auth --with-token $(auth token github)' diff --git a/git/.git-templates/hooks/pre-commit b/git/.git-templates/hooks/pre-commit new file mode 100755 index 0000000..f43796c --- /dev/null +++ b/git/.git-templates/hooks/pre-commit @@ -0,0 +1,7 @@ +#!/bin/sh +# branch="$(git branch --show-current)" +# if test "${branch}" = "master" -o "${branch}" = "main"; then +# echo "Cowardly refusing to commit on ${branch} branch." +# echo "You can delete this pre-hook or do it right." +# exit 1 +# fi diff --git a/git/setup b/git/setup new file mode 100755 index 0000000..1388692 --- /dev/null +++ b/git/setup @@ -0,0 +1,3 @@ +#!/bin/sh +rm -rf "$HOME/.git-templates" +ln -sf "$PWD/.git-templates" "$HOME/.git-templates" diff --git a/iam/config.yaml b/iam/config.yaml new file mode 100644 index 0000000..6e25652 --- /dev/null +++ b/iam/config.yaml @@ -0,0 +1,244 @@ +cat.509670=Science & Technology +cat.29595=Dota 2 +cat.509658=Just Chatting +cat.115977=The Witcher 3: Wild Hunt +cat.1469308723=Software and Game Development +cat.16676=Team Fortress 2 +cat.493575=SHENZHEN I/O +cat.272263131=Animals, Aquariums, and Zoos +cat.509671=Fitness & Health +cat.26936=Music +cat.509660=Art +cat.515214=Politics +cat.417752=Talk Shows & Podcasts +cat.498592=I'm Only Sleeping +cat.509672=Travel & Outdoors +cat.509673=Makers & Crafting +tag.linux=15f4833a-1691-4cc1-a4a5-020d130ac94d +tag.ama=67259b26-ff83-444e-9d3c-faab390df16f +tag.coworking=0739209c-9ef5-4ae0-997c-ccbeb864ca61 +tag.business=c38aeb6e-e8c7-452a-88e1-a3ed62c2e846 +tag.cooperative=63e83904-a70b-4709-b963-a37a105d9932 +tag.programming=a51f1e4e-257b-4bd0-90c7-189c3efbf917 +tag.educational=cea7bc0c-75a5-4446-8743-6db031b71550 +tag.writing=81975ba3-5c53-41f8-b614-ce5b3193955a +tag.editing=325a32c7-7b8e-48f8-b4fa-10875f18bb6d +tag.cozy=adc4a830-07f5-457b-95e5-5ab6cc1f9af3 +tag.skateboarding=fd6df368-7e76-4868-b9e9-b4f7cecc2f35 +tag.cycling=d5713b1e-c796-4bdc-88e2-93c49ce31136 +tag.animation=e3a6b378-232b-4ec2-9a82-86b72851e09a +tag.evil=0cef8341-8c67-481f-95a8-325932a6699c +tag.good=ee1daaae-116a-44d6-9f40-09322caf3181 +tag.endurance=3379ff9c-3c15-4bef-bfb8-2085cd196062 +tag.engineering=dff0aca6-52fe-4cc4-a93a-194852b522f0 +tag.backseating=96b6073f-450d-4248-8ed4-988e28f3f759 +tag.balance=8315b8d6-9837-4218-9bc1-3c0a3e5bb41d +tag.100=e659959d-392f-44c5-83a5-fb959cdbaccc +tag.achievements=27937cec-5cfc-4f56-b1d3-f6e1d67735e2 +tag.acoustic=eea4d45b-52e0-4a16-b0df-64f4c55bc716 +tag.behindscenes=26befb18-4ddc-41c1-8d39-ffeada297428 +tag.bodypositive=150f13a5-b1ce-4e85-a61f-7cfed2e2e08c +tag.chatty=afc8211a-8eee-48b8-9e18-212f22f657db +tag.chill=81e9d348-82e5-4c4f-a140-d2b3779b912d +tag.explore=a4fac2cc-7cd4-44a6-b620-178182389a5b +tag.filming=812a0088-22a9-4944-bb27-af0fa37b6085 +tag.firstplay=d0976a7e-26a7-4a48-9225-c522808540f2 +tag.gamedev=f588bd74-e496-4d11-9169-3597f38a5d25 +tag.softdev=6f86127d-6051-4a38-94bb-f7b475dde109 +tag.webdev=c23ce252-cf78-4b98-8c11-8769801aaf3a +tag.graphicdesign=0930677c-dd75-424d-9190-b779f3d1c136 +tag.hiking=2a824c85-8c64-4a62-9532-84a50633c6fc +tag.interviews=c833db83-32d0-4026-b3df-637ccf7899fa +tag.play=8ba227ca-073c-46a7-b3cc-193e52c5ab4d +tag.playwith=ac763b17-7bea-4632-9eb4-d106689ff409 +tag.leveling=6433db3e-37a7-4590-915a-7c0949a4ac89 +tag.vlogging=7a3d677a-1e09-4391-b520-1fccc0e7d6ca +tag.magic=1b70fcca-0579-446a-90d1-075c9ce62309 +tag.meditation=59b9c259-62c3-4a1a-89d4-4a6f1070deb9 +tag.mindfulness=9801169b-afa4-4785-890e-53911955e4d7 +tag.mealprep=3ce58361-f147-441d-a7c9-e98e3e916a39 +tag.movement=73645e21-02ae-4f39-bfb1-8dac623927ef +tag.musictalk=85d2fb8f-7257-4e08-8065-6161fa3029fa +tag.musicevents=c5247b10-deec-4d7a-84a5-db6a75cb5908 +tag.news=77017b7b-6b98-4f0d-bd39-3ba96b66ec7a +tag.outdoors=89e105c9-2c45-42a9-a5f0-fc1ea6e7ba8b +tag.practice=04b4aaaa-c410-4c2e-9beb-da3896fc7d22 +tag.reading=bd6fc011-575a-43f0-8418-9f912a295362 +tag.retro=e027fb8b-219e-4959-8240-a4a082be0316 +tag.robotics=56257f86-a66c-4ce8-af6d-89e9b1f13fed +tag.safespace=3575df89-da01-4fc1-939c-b5465093ed04 +tag.spirituality=63f8ee17-1678-41ee-906a-8c55c3ce81df +tag.strength=07a1b526-3725-4ba5-8c53-efaad4941fb9 +tag.surfing=8e44481a-4bc4-4155-b362-9bb499c15d3e +tag.tradart=5ec52c4f-a055-404c-82fe-ea98c74c7fe6 +tag.travel=a6ff589a-33e5-4caf-8286-29dea98fc2e2 +tag.tutorial=dc709206-c072-4340-a706-694578574c7e +tag.twitchcon=f317a85e-495e-4aee-a0d2-0720bd00a6ce +tag.usa=79713d37-6d2e-4953-b55b-8f47bb9caf72 +tag.vectorart=f0ab2b07-14ed-4429-8ea3-3d7d400a50cd +tag.viewerlevels=fec05015-e841-4cff-a53c-8aa1336cf863 +tag.warmingup=2920fbf2-293e-4753-8ec7-b69dba5392d0 +tag.wargame=dbe20395-0e44-4156-92de-4a77f6cdccf0 +tag.worldbuild=218c5e0e-e3a9-4fab-9ad5-994717d226fd +tag.easy=1eea2343-ca8e-4606-ab21-5c64e129f6db +tag.hard=ba2c968b-867a-49ce-aebc-3d978a204f4a +tag.beginners=ad18ee82-c0b2-46d4-b4f9-d45994443bd7 +tag.casuals=cc8d5abb-39c9-4942-a1ee-e1558512119e +tag.allbosses=860f0dc1-5d6b-4504-a3e2-eca15a1cb816 +tag.epic=df262ff6-74d1-415b-942c-d584d44426c4 +mode.away.emoji=🐟 +mode.away.name=away +mode.away.status=fishies and music +mode.away.flags=music|visual +mode.away.category=272263131 +mode.away.tags=linux,animation +mode.break.emoji=💤 +mode.break.name=break +mode.break.status=taking a break (< 30 minutes) +mode.break.flags=music | visual +mode.break.category=same +mode.break.tags= +mode.yoga.emoji=🧘 +mode.yoga.name=yoga +mode.yoga.status=ashtanga yoga asana (mysore style) +mode.yoga.flags=cam | mic | music | chat | focused +mode.yoga.category=509671 +mode.yoga.tags= +mode.run.emoji=🏃 +mode.run.name=run +mode.run.status=out running +mode.run.flags=cam | mic | chat | ama | out +mode.run.category=509658 +mode.run.tags= +mode.skate.emoji=🛹 +mode.skate.name=skate +mode.skate.status=out long-boarding +mode.skate.flags=cam | mic | chat | ama | out +mode.skate.category=509658 +mode.skate.tags= +mode.bike.emoji=🚴 +mode.bike.name=bike +mode.bike.status=out cycling +mode.bike.flags=cam | mic | chat | ama | out +mode.bike.category=509658 +mode.bike.tags= +mode.work.emoji=🏢 +mode.work.name=work +mode.work.status=kubernetes coworking +mode.work.flags=cam | mic | chat | focused | music | muted +mode.work.category=null +mode.work.tags=co-working +mode.code.emoji=💢 +mode.code.name=code +mode.code.status=bash, go, c, or web +mode.code.flags=cam | mic | chat | topical | music +mode.code.category=null +mode.code.tags=programming +mode.hack.emoji=🥷 +mode.hack.name=hack +mode.hack.status=hacking to learn +mode.hack.flags=cam | mic | chat | ama | music +mode.hack.category=null +mode.hack.tags= +mode.write.emoji=⌨️ +mode.write.name=write +mode.write.status=writing +mode.write.flags=cam | mic | chat | focused | topical | music +mode.write.category=509658 +mode.write.tags= +mode.rant.emoji=🤬 +mode.rant.name=rant +mode.rant.status=ranting +mode.rant.flags=cam | mic | chat | focused | topical | music +mode.rant.category=509658 +mode.rant.tags=evil +mode.clean.emoji=😐 +mode.clean.name=clean +mode.clean.status=cleaning lab/studio +mode.clean.flags=cam | mic | chat | music | ama +mode.clean.category=509658 +mode.clean.tags= +mode.dota2.emoji=⚔️ +mode.dota2.name=dota2 +mode.dota2.status=crystal, legion, chant, np, *ama chat* +mode.dota2.flags= +mode.dota2.category=null +mode.dota2.tags= +mode.witcher3.emoji=🐺 +mode.witcher3.name=witcher3 +mode.witcher3.status=cat school, triss line, *ama chat* +mode.witcher3.flags= +mode.witcher3.category=null +mode.witcher3.tags= +mode.shenzen.emoji=🔢 +mode.shenzen.name=shenzen +mode.shenzen.status=learning assembly-ish, *ama chat* +mode.shenzen.flags= +mode.shenzen.category=null +mode.shenzen.tags= +mode.tf2.emoji=🏹 +mode.tf2.name=tf2 +mode.tf2.status=bow sniper, engie, pyro, *ama chat* +mode.tf2.flags= +mode.tf2.category=null +mode.tf2.tags= +mode.learn.emoji=🤯 +mode.learn.name=learn +mode.learn.status=colearning, *topic chat* to help +mode.learn.flags= +mode.learn.category=null +mode.learn.tags= +mode.party.emoji=🎉 +mode.party.name=party +mode.party.status=music, dancing, drinking, *ama chat* +mode.party.flags= +mode.party.category=509658 +mode.party.tags= +mode.jaunt.emoji=🌤️ +mode.jaunt.name=jaunt +mode.jaunt.status=walk/talk, tours, adventures, *ama chat* +mode.jaunt.flags= +mode.jaunt.category=509658 +mode.jaunt.tags= +mode.art.emoji=🎨 +mode.art.name=art +mode.art.status=galleries, crawls, interviews, *topic chat* +mode.art.flags= +mode.art.category=509660 +mode.art.tags= +mode.music.emoji=🎵 +mode.music.name=music +mode.music.status=live music, pubs, *ama chat* +mode.music.flags= +mode.music.category=26936 +mode.music.tags= +mode.course.emoji=⚡ +mode.course.name=course +mode.course.status=instructional content, *topic chat* +mode.course.flags= +mode.course.category=null +mode.course.tags= +mode.morning.emoji=☕ +mode.morning.name=morning +mode.morning.status=cozy, wake-up, plan, news, *ama chat* +mode.morning.flags= +mode.morning.category=509658 +mode.morning.tags= +mode.talk.emoji=☎️ +mode.talk.name=talk +mode.talk.status=invited guests in discord, *topic ama* +mode.talk.flags= +mode.talk.category=417752 +mode.talk.tags= +mode.hang.emoji=🍻 +mode.hang.name=hang +mode.hang.status=discord lobby, members only, *ama chat* +mode.hang.flags= +mode.hang.category=509658 +mode.hang.tags= +mode.record.emoji=🎬 +mode.record.name=record +mode.record.status=make specific youtube videos, *no chat* +mode.record.flags= +mode.record.category=null +mode.record.tags= diff --git a/iam/setup b/iam/setup new file mode 100755 index 0000000..e59569d --- /dev/null +++ b/iam/setup @@ -0,0 +1,3 @@ +#!/bin/bash +mkdir -p ~/.config/iam +ln -fs "$PWD/config.yaml" ~/.config/iam/config.yaml diff --git a/install/README.md b/install/README.md new file mode 100644 index 0000000..95e2b0d --- /dev/null +++ b/install/README.md @@ -0,0 +1,7 @@ +# Install Scripts + +Here are some installer scripts I've collected and use to build my +workspace image and vm. It is nice to have these separated out because +sometimes I just want to install on hardware or WSL2 or something and +don't have Docker. + diff --git a/install/linux/install-ansible b/install/linux/install-ansible new file mode 100755 index 0000000..4dfdaf5 --- /dev/null +++ b/install/linux/install-ansible @@ -0,0 +1,6 @@ +#!/bin/bash + +sudo add-apt-repository --yes --update ppa:ansible/ansible +sudo apt install ansible +sudo apt install python3-argcomplete +sudo activate-global-python-argcomplete3 diff --git a/install/linux/install-docker b/install/linux/install-docker new file mode 100755 index 0000000..c41cd78 --- /dev/null +++ b/install/linux/install-docker @@ -0,0 +1,511 @@ +#!/bin/sh +set -e + +# Docker CE for Linux installation script +# +# See https://docs.docker.com/install/ for the installation steps. +# +# This script is meant for quick & easy install via: +# $ curl -fsSL https://get.docker.com -o get-docker.sh +# $ sh get-docker.sh +# +# For test builds (ie. release candidates): +# $ curl -fsSL https://test.docker.com -o test-docker.sh +# $ sh test-docker.sh +# +# NOTE: Make sure to verify the contents of the script +# you downloaded matches the contents of install.sh +# located at https://github.com/docker/docker-install +# before executing. +# +# Git commit from https://github.com/docker/docker-install when +# the script was uploaded (Should only be modified by upload job): +SCRIPT_COMMIT_SHA="3d8fe77c2c46c5b7571f94b42793905e5b3e42e4" + +# The channel to install from: +# * nightly +# * test +# * stable +# * edge (deprecated) +DEFAULT_CHANNEL_VALUE="stable" +if [ -z "$CHANNEL" ]; then + CHANNEL=$DEFAULT_CHANNEL_VALUE +fi + +DEFAULT_DOWNLOAD_URL="https://download.docker.com" +if [ -z "$DOWNLOAD_URL" ]; then + DOWNLOAD_URL=$DEFAULT_DOWNLOAD_URL +fi + +DEFAULT_REPO_FILE="docker-ce.repo" +if [ -z "$REPO_FILE" ]; then + REPO_FILE="$DEFAULT_REPO_FILE" +fi + +mirror='' +DRY_RUN=${DRY_RUN:-} +while [ $# -gt 0 ]; do + case "$1" in + --mirror) + mirror="$2" + shift + ;; + --dry-run) + DRY_RUN=1 + ;; + --*) + echo "Illegal option $1" + ;; + esac + shift $(($# > 0 ? 1 : 0)) +done + +case "$mirror" in +Aliyun) + DOWNLOAD_URL="https://mirrors.aliyun.com/docker-ce" + ;; +AzureChinaCloud) + DOWNLOAD_URL="https://mirror.azure.cn/docker-ce" + ;; +esac + +command_exists() { + command -v "$@" >/dev/null 2>&1 +} + +is_dry_run() { + if [ -z "$DRY_RUN" ]; then + return 1 + else + return 0 + fi +} + +is_wsl() { + case "$(uname -r)" in + *microsoft*) true ;; # WSL 2 + *Microsoft*) true ;; # WSL 1 + *) false ;; + esac +} + +is_darwin() { + case "$(uname -s)" in + *darwin*) true ;; + *Darwin*) true ;; + *) false ;; + esac +} + +deprecation_notice() { + distro=$1 + date=$2 + echo + echo "DEPRECATION WARNING:" + echo " The distribution, $distro, will no longer be supported in this script as of $date." + echo " If you feel this is a mistake please submit an issue at https://github.com/docker/docker-install/issues/new" + echo + sleep 10 +} + +get_distribution() { + lsb_dist="" + # Every system that we officially support has /etc/os-release + if [ -r /etc/os-release ]; then + lsb_dist="$(. /etc/os-release && echo "$ID")" + fi + # Returning an empty string here should be alright since the + # case statements don't act unless you provide an actual value + echo "$lsb_dist" +} + +add_debian_backport_repo() { + debian_version="$1" + backports="deb http://ftp.debian.org/debian $debian_version-backports main" + if ! grep -Fxq "$backports" /etc/apt/sources.list; then + ( + set -x + $sh_c "echo \"$backports\" >> /etc/apt/sources.list" + ) + fi +} + +echo_docker_as_nonroot() { + if is_dry_run; then + return + fi + if command_exists docker && [ -e /var/run/docker.sock ]; then + ( + set -x + $sh_c 'docker version' + ) || true + fi + your_user=your-user + [ "$user" != 'root' ] && your_user="$user" + # intentionally mixed spaces and tabs here -- tabs are stripped by "<<-EOF", spaces are kept in the output + echo "If you would like to use Docker as a non-root user, you should now consider" + echo "adding your user to the \"docker\" group with something like:" + echo + echo " sudo usermod -aG docker $your_user" + echo + echo "Remember that you will have to log out and back in for this to take effect!" + echo + echo "WARNING: Adding a user to the \"docker\" group will grant the ability to run" + echo " containers which can be used to obtain root privileges on the" + echo " docker host." + echo " Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface" + echo " for more information." + +} + +# Check if this is a forked Linux distro +check_forked() { + + # Check for lsb_release command existence, it usually exists in forked distros + if command_exists lsb_release; then + # Check if the `-u` option is supported + set +e + lsb_release -a -u >/dev/null 2>&1 + lsb_release_exit_code=$? + set -e + + # Check if the command has exited successfully, it means we're in a forked distro + if [ "$lsb_release_exit_code" = "0" ]; then + # Print info about current distro + cat <<-EOF + You're using '$lsb_dist' version '$dist_version'. + EOF + + # Get the upstream release info + lsb_dist=$(lsb_release -a -u 2>&1 | tr '[:upper:]' '[:lower:]' | grep -E 'id' | cut -d ':' -f 2 | tr -d '[:space:]') + dist_version=$(lsb_release -a -u 2>&1 | tr '[:upper:]' '[:lower:]' | grep -E 'codename' | cut -d ':' -f 2 | tr -d '[:space:]') + + # Print info about upstream distro + cat <<-EOF + Upstream release is '$lsb_dist' version '$dist_version'. + EOF + else + if [ -r /etc/debian_version ] && [ "$lsb_dist" != "ubuntu" ] && [ "$lsb_dist" != "raspbian" ]; then + if [ "$lsb_dist" = "osmc" ]; then + # OSMC runs Raspbian + lsb_dist=raspbian + else + # We're Debian and don't even know it! + lsb_dist=debian + fi + dist_version="$(sed 's/\/.*//' /etc/debian_version | sed 's/\..*//')" + case "$dist_version" in + 10) + dist_version="buster" + ;; + 9) + dist_version="stretch" + ;; + 8 | 'Kali Linux 2') + dist_version="jessie" + ;; + esac + fi + fi + fi +} + +semverParse() { + major="${1%%.*}" + minor="${1#$major.}" + minor="${minor%%.*}" + patch="${1#$major.$minor.}" + patch="${patch%%[-.]*}" +} + +do_install() { + echo "# Executing docker install script, commit: $SCRIPT_COMMIT_SHA" + + if command_exists docker; then + docker_version="$(docker -v | cut -d ' ' -f3 | cut -d ',' -f1)" + MAJOR_W=1 + MINOR_W=10 + + semverParse "$docker_version" + + shouldWarn=0 + if [ "$major" -lt "$MAJOR_W" ]; then + shouldWarn=1 + fi + + if [ "$major" -le "$MAJOR_W" ] && [ "$minor" -lt "$MINOR_W" ]; then + shouldWarn=1 + fi + + cat >&2 <<-'EOF' + Warning: the "docker" command appears to already exist on this system. + + If you already have Docker installed, this script can cause trouble, which is + why we're displaying this warning and provide the opportunity to cancel the + installation. + + If you installed the current Docker package using this script and are using it + EOF + + if [ $shouldWarn -eq 1 ]; then + cat >&2 <<-'EOF' + again to update Docker, we urge you to migrate your image store before upgrading + to v1.10+. + + You can find instructions for this here: + https://github.com/docker/docker/wiki/Engine-v1.10.0-content-addressability-migration + EOF + else + cat >&2 <<-'EOF' + again to update Docker, you can safely ignore this message. + EOF + fi + + cat >&2 <<-'EOF' + + You may press Ctrl+C now to abort this script. + EOF + ( + set -x + sleep 20 + ) + fi + + user="$(id -un 2>/dev/null || true)" + + sh_c='sh -c' + if [ "$user" != 'root' ]; then + if command_exists sudo; then + sh_c='sudo -E sh -c' + elif command_exists su; then + sh_c='su -c' + else + cat >&2 <<-'EOF' + Error: this installer needs the ability to run commands as root. + We are unable to find either "sudo" or "su" available to make this happen. + EOF + exit 1 + fi + fi + + if is_dry_run; then + sh_c="echo" + fi + + # perform some very rudimentary platform detection + lsb_dist=$(get_distribution) + lsb_dist="$(echo "$lsb_dist" | tr '[:upper:]' '[:lower:]')" + + if is_wsl; then + echo + echo "WSL DETECTED: We recommend using Docker Desktop for Windows." + echo "Please get Docker Desktop from https://www.docker.com/products/docker-desktop" + echo + cat >&2 <<-'EOF' + + You may press Ctrl+C now to abort this script. + EOF + ( + set -x + sleep 20 + ) + fi + + case "$lsb_dist" in + + ubuntu) + if command_exists lsb_release; then + dist_version="$(lsb_release --codename | cut -f2)" + fi + if [ -z "$dist_version" ] && [ -r /etc/lsb-release ]; then + dist_version="$(. /etc/lsb-release && echo "$DISTRIB_CODENAME")" + fi + ;; + + debian | raspbian) + dist_version="$(sed 's/\/.*//' /etc/debian_version | sed 's/\..*//')" + case "$dist_version" in + 10) + dist_version="buster" + ;; + 9) + dist_version="stretch" + ;; + 8) + dist_version="jessie" + ;; + esac + ;; + + centos | rhel) + if [ -z "$dist_version" ] && [ -r /etc/os-release ]; then + dist_version="$(. /etc/os-release && echo "$VERSION_ID")" + fi + ;; + + *) + if command_exists lsb_release; then + dist_version="$(lsb_release --release | cut -f2)" + fi + if [ -z "$dist_version" ] && [ -r /etc/os-release ]; then + dist_version="$(. /etc/os-release && echo "$VERSION_ID")" + fi + ;; + + esac + + # Check if this is a forked Linux distro + check_forked + + # Run setup for each distro accordingly + case "$lsb_dist" in + ubuntu | debian | raspbian) + pre_reqs="apt-transport-https ca-certificates curl" + if [ "$lsb_dist" = "debian" ]; then + # libseccomp2 does not exist for debian jessie main repos for aarch64 + if [ "$(uname -m)" = "aarch64" ] && [ "$dist_version" = "jessie" ]; then + add_debian_backport_repo "$dist_version" + fi + fi + + if ! command -v gpg >/dev/null; then + pre_reqs="$pre_reqs gnupg" + fi + apt_repo="deb [arch=$(dpkg --print-architecture)] $DOWNLOAD_URL/linux/$lsb_dist $dist_version $CHANNEL" + ( + if ! is_dry_run; then + set -x + fi + $sh_c 'apt-get update -qq >/dev/null' + $sh_c "DEBIAN_FRONTEND=noninteractive apt-get install -y -qq $pre_reqs >/dev/null" + $sh_c "curl -fsSL \"$DOWNLOAD_URL/linux/$lsb_dist/gpg\" | apt-key add -qq - >/dev/null" + $sh_c "echo \"$apt_repo\" > /etc/apt/sources.list.d/docker.list" + $sh_c 'apt-get update -qq >/dev/null' + ) + pkg_version="" + if [ -n "$VERSION" ]; then + if is_dry_run; then + echo "# WARNING: VERSION pinning is not supported in DRY_RUN" + else + # Will work for incomplete versions IE (17.12), but may not actually grab the "latest" if in the test channel + pkg_pattern="$(echo "$VERSION" | sed "s/-ce-/~ce~.*/g" | sed "s/-/.*/g").*-0~$lsb_dist" + search_command="apt-cache madison 'docker-ce' | grep '$pkg_pattern' | head -1 | awk '{\$1=\$1};1' | cut -d' ' -f 3" + pkg_version="$($sh_c "$search_command")" + echo "INFO: Searching repository for VERSION '$VERSION'" + echo "INFO: $search_command" + if [ -z "$pkg_version" ]; then + echo + echo "ERROR: '$VERSION' not found amongst apt-cache madison results" + echo + exit 1 + fi + search_command="apt-cache madison 'docker-ce-cli' | grep '$pkg_pattern' | head -1 | awk '{\$1=\$1};1' | cut -d' ' -f 3" + # Don't insert an = for cli_pkg_version, we'll just include it later + cli_pkg_version="$($sh_c "$search_command")" + pkg_version="=$pkg_version" + fi + fi + ( + if ! is_dry_run; then + set -x + fi + if [ -n "$cli_pkg_version" ]; then + $sh_c "apt-get install -y -qq --no-install-recommends docker-ce-cli=$cli_pkg_version >/dev/null" + fi + $sh_c "apt-get install -y -qq --no-install-recommends docker-ce$pkg_version >/dev/null" + ) + echo_docker_as_nonroot + exit 0 + ;; + centos | fedora | rhel) + yum_repo="$DOWNLOAD_URL/linux/$lsb_dist/$REPO_FILE" + if ! curl -Ifs "$yum_repo" >/dev/null; then + echo "Error: Unable to curl repository file $yum_repo, is it valid?" + exit 1 + fi + if [ "$lsb_dist" = "fedora" ]; then + pkg_manager="dnf" + config_manager="dnf config-manager" + enable_channel_flag="--set-enabled" + disable_channel_flag="--set-disabled" + pre_reqs="dnf-plugins-core" + pkg_suffix="fc$dist_version" + else + pkg_manager="yum" + config_manager="yum-config-manager" + enable_channel_flag="--enable" + disable_channel_flag="--disable" + pre_reqs="yum-utils" + pkg_suffix="el" + fi + ( + if ! is_dry_run; then + set -x + fi + $sh_c "$pkg_manager install -y -q $pre_reqs" + $sh_c "$config_manager --add-repo $yum_repo" + + if [ "$CHANNEL" != "stable" ]; then + $sh_c "$config_manager $disable_channel_flag docker-ce-*" + $sh_c "$config_manager $enable_channel_flag docker-ce-$CHANNEL" + fi + $sh_c "$pkg_manager makecache" + ) + pkg_version="" + if [ -n "$VERSION" ]; then + if is_dry_run; then + echo "# WARNING: VERSION pinning is not supported in DRY_RUN" + else + pkg_pattern="$(echo "$VERSION" | sed "s/-ce-/\\\\.ce.*/g" | sed "s/-/.*/g").*$pkg_suffix" + search_command="$pkg_manager list --showduplicates 'docker-ce' | grep '$pkg_pattern' | tail -1 | awk '{print \$2}'" + pkg_version="$($sh_c "$search_command")" + echo "INFO: Searching repository for VERSION '$VERSION'" + echo "INFO: $search_command" + if [ -z "$pkg_version" ]; then + echo + echo "ERROR: '$VERSION' not found amongst $pkg_manager list results" + echo + exit 1 + fi + search_command="$pkg_manager list --showduplicates 'docker-ce-cli' | grep '$pkg_pattern' | tail -1 | awk '{print \$2}'" + # It's okay for cli_pkg_version to be blank, since older versions don't support a cli package + cli_pkg_version="$($sh_c "$search_command" | cut -d':' -f 2)" + # Cut out the epoch and prefix with a '-' + pkg_version="-$(echo "$pkg_version" | cut -d':' -f 2)" + fi + fi + ( + if ! is_dry_run; then + set -x + fi + # install the correct cli version first + if [ -n "$cli_pkg_version" ]; then + $sh_c "$pkg_manager install -y -q docker-ce-cli-$cli_pkg_version" + fi + $sh_c "$pkg_manager install -y -q docker-ce$pkg_version" + ) + echo_docker_as_nonroot + exit 0 + ;; + *) + if [ -z "$lsb_dist" ]; then + if is_darwin; then + echo + echo "ERROR: Unsupported operating system 'macOS'" + echo "Please get Docker Desktop from https://www.docker.com/products/docker-desktop" + echo + exit 1 + fi + fi + echo + echo "ERROR: Unsupported distribution '$lsb_dist'" + echo + exit 1 + ;; + esac + exit 1 +} + +# wrapped up in a function so that we have some protection against only getting +# half the file during "curl | sh" +do_install diff --git a/install/linux/install-gh b/install/linux/install-gh new file mode 100755 index 0000000..517fa7d --- /dev/null +++ b/install/linux/install-gh @@ -0,0 +1,10 @@ +#!/bin/bash + +curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | \ + sudo dd of=/etc/apt/trusted.gpg.d/githubcli-archive-keyring.gpg + +echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/trusted.gpg.d/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | \ + sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null + +sudo apt update +sudo apt install gh diff --git a/install/linux/install-go b/install/linux/install-go new file mode 100755 index 0000000..449b128 --- /dev/null +++ b/install/linux/install-go @@ -0,0 +1,22 @@ +#!/bin/sh +set -e + +cd "$(mktemp -d)" + +# TODO eventually update this to detect +os=mac +arch=amd64 + +file=$(curl -sSL "https://golang.org/dl/?mode=json" \ + | jq -r '.[0].files[] + | select(.os == "'"$os"'") + | select(.arch == "'"$arch"'") + | .filename') + +curl -sSLO \ + -H "Accept: application/vnd.github.v3+json" \ + "https://dl.google.com/go/$file" + +sudo tar xzf "$file" -C /usr/local/ + +echo "Make sure /usr/local/go/bin is in PATH" diff --git a/install/linux/install-helm b/install/linux/install-helm new file mode 100755 index 0000000..c0a47fe --- /dev/null +++ b/install/linux/install-helm @@ -0,0 +1,16 @@ +#!/bin/sh +set -e + +# If you like packages ... +# curl https://baltocdn.com/helm/signing.asc | sudo apt-key add - +# sudo apt-get install apt-transport-https --yes +# echo "deb https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.li +# st.d/helm-stable-debian.list +# sudo apt-get update +# sudo apt-get install helm + +# ... or you can do it directly +cd $(mktemp -d) +curl -fsSL -O https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 +#export HELM_INSTALL_DIR="${HOME}/.local/bin" +bash ./get-helm-3 diff --git a/install/linux/install-hyperfine b/install/linux/install-hyperfine new file mode 100755 index 0000000..381b70e --- /dev/null +++ b/install/linux/install-hyperfine @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +latest="https://api.github.com/repos/sharkdp/hyperfine/releases/latest" +ver=$(curl -sS "$latest" | jq -r .zipball_url) && test -n "$ver" +ver=${ver##*/} && deb="hyperfine_${ver#v}_amd64.deb" +url="https://github.com/sharkdp/hyperfine/releases/download/$ver/$deb" +curl -sSLO "$url" && dpkg -i ./*.deb diff --git a/install/linux/install-kind b/install/linux/install-kind new file mode 100755 index 0000000..d24d6d8 --- /dev/null +++ b/install/linux/install-kind @@ -0,0 +1,4 @@ +#!/usr/bin/bash +exec go install sigs.k8s.io/kind@latest + + diff --git a/install/linux/install-kompose b/install/linux/install-kompose new file mode 100755 index 0000000..f885b38 --- /dev/null +++ b/install/linux/install-kompose @@ -0,0 +1,5 @@ +#!/usr/bin/bash +target="$GOBIN/kompose" +#exec go install github.com/kubernetes/kompose@latest +curl -sSL https://github.com/kubernetes/kompose/releases/download/v1.26.1/kompose-linux-amd64 -o "$target" +chmod +x "$target" diff --git a/install/linux/install-kubectl b/install/linux/install-kubectl new file mode 100755 index 0000000..8045fe7 --- /dev/null +++ b/install/linux/install-kubectl @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +V=$(curl -L -s https://dl.k8s.io/release/stable.txt) +curl -sSLO "https://dl.k8s.io/release/${V}/bin/linux/amd64/kubectl" +curl -sSLO "https://dl.k8s.io/${V}/bin/linux/amd64/kubectl.sha256" +echo "$(head -1 kubectl.sha256) kubectl" | sha256sum --check +cp kubectl /usr/bin && chmod +x /usr/bin/kubectl diff --git a/install/linux/install-obs-captions-plugin b/install/linux/install-obs-captions-plugin new file mode 100755 index 0000000..eb48f02 --- /dev/null +++ b/install/linux/install-obs-captions-plugin @@ -0,0 +1,30 @@ +#!/bin/bash +set -e + +obs=$(command -v obs) + +[[ -z "$obs" ]] && echo "OBS not found" && exit 1 + +ver=$($obs -V) +[[ $ver =~ ([0-9]+)\.([0-9]+)\.([0-9]+) ]] +major=${BASH_REMATCH[1]} +minor=${BASH_REMATCH[2]} +patch=${BASH_REMATCH[3]} + +url="https://api.github.com/repos/ratwithacompiler/OBS-captions-plugin/releases/latest" + +if (( major < 27 )); then + url="https://api.github.com/repos/ratwithacompiler/OBS-captions-plugin/releases/tags/v0.18b" +fi + +dir=$(mktemp -d) +cd "$dir" +echo "Working directory now $dir" +curl -sSL "$url" -o release.json +name=$(jq -r .name release.json) +url=$(jq -r '.assets[].browser_download_url' release.json | grep Linux) +echo "Attempting to download $name from $url" +curl -LO "$url" +unzip *.zip +mv *Linux/libobs_google_caption_plugin "$HOME/.config/obs-studio/plugins" +rm -rf "$dir" diff --git a/install/linux/install-pandoc b/install/linux/install-pandoc new file mode 100755 index 0000000..1fbfc4e --- /dev/null +++ b/install/linux/install-pandoc @@ -0,0 +1,9 @@ +#!/bin/sh +set -e +loc=$(curl -o /dev/null -sIw "%{redirect_url}" \ + 'https://github.com/jgm/pandoc/releases/latest') + vers=${loc##*/} +deb="pandoc-$vers-1-amd64.deb" +uri=${loc%/tag*}/download/$vers/$deb +curl -sL "$uri" -o "/tmp/$deb" +dpkg -i "/tmp/$deb" diff --git a/install/linux/install-rancher-desktop b/install/linux/install-rancher-desktop new file mode 100755 index 0000000..ed27882 --- /dev/null +++ b/install/linux/install-rancher-desktop @@ -0,0 +1,9 @@ +#!/bin/bash + +# WARNING: this will fuck up your terminal and overwrite stuff, be +# careful + +curl https://download.opensuse.org/repositories/isv:/Rancher:/stable/deb/Release.key | sudo apt-key add - +sudo add-apt-repository 'deb https://download.opensuse.org/repositories/isv:/Rancher:/stable/deb/ ./' +sudo apt update +sudo apt install rancher-desktop diff --git a/install/linux/install-talosctl b/install/linux/install-talosctl new file mode 100755 index 0000000..f527d55 --- /dev/null +++ b/install/linux/install-talosctl @@ -0,0 +1,5 @@ +#!/bin/bash +dir="$HOME/.local/bin" +mkdir -p "$dir" +curl -L https://github.com/talos-systems/talos/releases/latest/download/talosctl-linux-amd64 -o "$dir"/talosctl +chmod +x "$dir/talosctl" diff --git a/install/linux/install-terraform b/install/linux/install-terraform new file mode 100755 index 0000000..22c377f --- /dev/null +++ b/install/linux/install-terraform @@ -0,0 +1,12 @@ +#!/bin/bash + +ver=1.1.3 + +[[ -z "$GOBIN" ]] && echo "GOBIN not set" && exit 1 + +dir=$(mktemp -d) +cd "$dir" +echo "Now working from $dir" +curl -sSLO "https://releases.hashicorp.com/terraform/$ver/terraform_${ver}_linux_amd64.zip" +unzip -q *.zip +mv terraform "$GOBIN" diff --git a/install/linux/install-twurl b/install/linux/install-twurl new file mode 100755 index 0000000..f2e6167 --- /dev/null +++ b/install/linux/install-twurl @@ -0,0 +1,2 @@ +#!/bin/bash +sudo gem install twurl diff --git a/install/linux/install-vagrant b/install/linux/install-vagrant new file mode 100755 index 0000000..f566a9e --- /dev/null +++ b/install/linux/install-vagrant @@ -0,0 +1,18 @@ +#!/bin/bash +docker pull vagrantlibvirt/vagrant-libvirt:latest +echo ' +Now add the following function to your ~/.bashrc: + +vagrant () +{ + docker run -it --rm \ + -e LIBVIRT_DEFAULT_URI \ + -v /var/run/libvirt/:/var/run/libvirt/ \ + -v ~/.vagrant.d:/.vagrant.d \ + -v $(realpath "${PWD}"):${PWD} \ + -w $(realpath "${PWD}") \ + --network host \ + vagrantlibvirt/vagrant-libvirt:latest vagrant "$@" +} +' + diff --git a/install/mac/install-bash b/install/mac/install-bash new file mode 100755 index 0000000..17d11bd --- /dev/null +++ b/install/mac/install-bash @@ -0,0 +1,6 @@ +#!/bin/sh +brew install bash +echo "Now don't forget:" +echo " Add /usr/local/bin/bash to /etc/shells" +echo " Run chsh -s /usr/local/bin/bash" +echo " Use #!/usr/bin/env bash as shebang line" diff --git a/install/mac/install-jq b/install/mac/install-jq new file mode 100755 index 0000000..c056982 --- /dev/null +++ b/install/mac/install-jq @@ -0,0 +1,2 @@ +#!/bin/sh +exec brew install jq diff --git a/install/mac/install-lynx b/install/mac/install-lynx new file mode 100755 index 0000000..1f7d6c6 --- /dev/null +++ b/install/mac/install-lynx @@ -0,0 +1,2 @@ +#!/bin/sh +exec brew install lynx diff --git a/install/mac/iterm2/rwxrob.json b/install/mac/iterm2/rwxrob.json new file mode 100644 index 0000000..cbc56c6 --- /dev/null +++ b/install/mac/iterm2/rwxrob.json @@ -0,0 +1,405 @@ +{ + "Use Non-ASCII Font" : false, + "Tags" : [ + + ], + "Ansi 12 Color" : { + "Red Component" : 0.51372551918029785, + "Color Space" : "Calibrated", + "Blue Component" : 0.59607845544815063, + "Alpha Component" : 1, + "Green Component" : 0.64705884456634521 + }, + "Ansi 6 Color" : { + "Red Component" : 0.40784314274787903, + "Color Space" : "Calibrated", + "Blue Component" : 0.41568627953529358, + "Alpha Component" : 1, + "Green Component" : 0.61568629741668701 + }, + "Draw Powerline Glyphs" : true, + "Bold Color" : { + "Red Component" : 0.90980392694473267, + "Color Space" : "Calibrated", + "Blue Component" : 0.64313727617263794, + "Alpha Component" : 1, + "Green Component" : 0.83137255907058716 + }, + "Normal Font" : "UbuntuMono-Regular 30", + "Link Color" : { + "Red Component" : 0.7450980544090271, + "Color Space" : "Calibrated", + "Blue Component" : 0.090196080505847931, + "Alpha Component" : 1, + "Green Component" : 0.058823529630899429 + }, + "Ansi 1 Color" : { + "Red Component" : 0.80000001192092896, + "Color Space" : "Calibrated", + "Blue Component" : 0.11372549086809158, + "Alpha Component" : 1, + "Green Component" : 0.14117647707462311 + }, + "Rows" : 29, + "Default Bookmark" : "No", + "Ansi 2 Color" : { + "Red Component" : 0.59607845544815063, + "Color Space" : "Calibrated", + "Blue Component" : 0.10196078568696976, + "Alpha Component" : 1, + "Green Component" : 0.59215688705444336 + }, + "Cursor Guide Color" : { + "Red Component" : 0.64999997615814209, + "Color Space" : "Calibrated", + "Blue Component" : 1, + "Alpha Component" : 0.25, + "Green Component" : 0.9100000262260437 + }, + "Non-ASCII Anti Aliased" : true, + "Use Bright Bold" : true, + "Ansi 10 Color" : { + "Red Component" : 0.72156864404678345, + "Color Space" : "Calibrated", + "Blue Component" : 0.14901961386203766, + "Alpha Component" : 1, + "Green Component" : 0.73333334922790527 + }, + "Prevent Opening in a Tab" : true, + "Ambiguous Double Width" : false, + "Jobs to Ignore" : [ + "rlogin", + "ssh", + "slogin", + "telnet" + ], + "Ansi 15 Color" : { + "Red Component" : 0.92156863212585449, + "Color Space" : "Calibrated", + "Blue Component" : 0.69803923368453979, + "Alpha Component" : 1, + "Green Component" : 0.85882353782653809 + }, + "Foreground Color" : { + "Red Component" : 0.90980392694473267, + "Color Space" : "Calibrated", + "Blue Component" : 0.64313727617263794, + "Alpha Component" : 1, + "Green Component" : 0.83137255907058716 + }, + "Working Directory" : "\/Users\/rwxrob", + "Blinking Cursor" : true, + "Disable Window Resizing" : true, + "Sync Title" : false, + "Prompt Before Closing 2" : false, + "BM Growl" : true, + "Command" : "", + "Description" : "Default", + "Mouse Reporting" : true, + "Screen" : -1, + "Selection Color" : { + "Red Component" : 0.19607843458652496, + "Color Space" : "Calibrated", + "Blue Component" : 0.18431372940540314, + "Alpha Component" : 1, + "Green Component" : 0.18823529779911041 + }, + "Columns" : 107, + "Idle Code" : 0, + "Ansi 13 Color" : { + "Red Component" : 0.82745099067687988, + "Color Space" : "Calibrated", + "Blue Component" : 0.60784316062927246, + "Alpha Component" : 1, + "Green Component" : 0.52549022436141968 + }, + "Custom Command" : "No", + "ASCII Anti Aliased" : true, + "Non Ascii Font" : "Monaco 12", + "Vertical Spacing" : 1, + "Use Bold Font" : true, + "Option Key Sends" : 0, + "Selected Text Color" : { + "Red Component" : 0.70916998386383057, + "Color Space" : "Calibrated", + "Blue Component" : 0.70916998386383057, + "Alpha Component" : 1, + "Green Component" : 0.70916998386383057 + }, + "Background Color" : { + "Red Component" : 0.10980392247438431, + "Color Space" : "Calibrated", + "Blue Component" : 0.10980392247438431, + "Alpha Component" : 1, + "Green Component" : 0.10980392247438431 + }, + "Character Encoding" : 4, + "Ansi 11 Color" : { + "Red Component" : 0.98039215803146362, + "Color Space" : "Calibrated", + "Blue Component" : 0.18431372940540314, + "Alpha Component" : 1, + "Green Component" : 0.74117648601531982 + }, + "Use Italic Font" : true, + "Unlimited Scrollback" : false, + "Keyboard Map" : { + "0xf700-0x260000" : { + "Action" : 10, + "Text" : "[1;6A" + }, + "0x37-0x40000" : { + "Action" : 11, + "Text" : "0x1f" + }, + "0x32-0x40000" : { + "Action" : 11, + "Text" : "0x00" + }, + "0xf709-0x20000" : { + "Action" : 10, + "Text" : "[17;2~" + }, + "0xf70c-0x20000" : { + "Action" : 10, + "Text" : "[20;2~" + }, + "0xf729-0x20000" : { + "Action" : 10, + "Text" : "[1;2H" + }, + "0xf72b-0x40000" : { + "Action" : 10, + "Text" : "[1;5F" + }, + "0xf705-0x20000" : { + "Action" : 10, + "Text" : "[1;2Q" + }, + "0xf703-0x260000" : { + "Action" : 10, + "Text" : "[1;6C" + }, + "0xf700-0x220000" : { + "Action" : 10, + "Text" : "[1;2A" + }, + "0xf701-0x280000" : { + "Action" : 11, + "Text" : "0x1b 0x1b 0x5b 0x42" + }, + "0x38-0x40000" : { + "Action" : 11, + "Text" : "0x7f" + }, + "0x33-0x40000" : { + "Action" : 11, + "Text" : "0x1b" + }, + "0xf703-0x220000" : { + "Action" : 10, + "Text" : "[1;2C" + }, + "0xf701-0x240000" : { + "Action" : 10, + "Text" : "[1;5B" + }, + "0xf70d-0x20000" : { + "Action" : 10, + "Text" : "[21;2~" + }, + "0xf702-0x260000" : { + "Action" : 10, + "Text" : "[1;6D" + }, + "0xf729-0x40000" : { + "Action" : 10, + "Text" : "[1;5H" + }, + "0xf706-0x20000" : { + "Action" : 10, + "Text" : "[1;2R" + }, + "0x34-0x40000" : { + "Action" : 11, + "Text" : "0x1c" + }, + "0xf700-0x280000" : { + "Action" : 11, + "Text" : "0x1b 0x1b 0x5b 0x41" + }, + "0x2d-0x40000" : { + "Action" : 11, + "Text" : "0x1f" + }, + "0xf70e-0x20000" : { + "Action" : 10, + "Text" : "[23;2~" + }, + "0xf702-0x220000" : { + "Action" : 10, + "Text" : "[1;2D" + }, + "0xf703-0x280000" : { + "Action" : 11, + "Text" : "0x1b 0x1b 0x5b 0x43" + }, + "0xf700-0x240000" : { + "Action" : 10, + "Text" : "[1;5A" + }, + "0xf707-0x20000" : { + "Action" : 10, + "Text" : "[1;2S" + }, + "0xf70a-0x20000" : { + "Action" : 10, + "Text" : "[18;2~" + }, + "0x35-0x40000" : { + "Action" : 11, + "Text" : "0x1d" + }, + "0xf70f-0x20000" : { + "Action" : 10, + "Text" : "[24;2~" + }, + "0xf703-0x240000" : { + "Action" : 10, + "Text" : "[1;5C" + }, + "0xf701-0x260000" : { + "Action" : 10, + "Text" : "[1;6B" + }, + "0xf702-0x280000" : { + "Action" : 11, + "Text" : "0x1b 0x1b 0x5b 0x44" + }, + "0xf72b-0x20000" : { + "Action" : 10, + "Text" : "[1;2F" + }, + "0x36-0x40000" : { + "Action" : 11, + "Text" : "0x1e" + }, + "0xf708-0x20000" : { + "Action" : 10, + "Text" : "[15;2~" + }, + "0xf701-0x220000" : { + "Action" : 10, + "Text" : "[1;2B" + }, + "0xf70b-0x20000" : { + "Action" : 10, + "Text" : "[19;2~" + }, + "0xf702-0x240000" : { + "Action" : 10, + "Text" : "[1;5D" + }, + "0xf704-0x20000" : { + "Action" : 10, + "Text" : "[1;2P" + } + }, + "Window Type" : 0, + "Cursor Boost" : 0, + "Background Image Location" : "", + "Blur" : false, + "Badge Color" : { + "Red Component" : 1, + "Color Space" : "Calibrated", + "Blue Component" : 0, + "Alpha Component" : 0.5, + "Green Component" : 0 + }, + "Scrollback Lines" : 1000, + "Send Code When Idle" : false, + "Close Sessions On End" : true, + "Terminal Type" : "xterm-256color", + "Visual Bell" : true, + "Flashing Bell" : false, + "Silence Bell" : true, + "Ansi 14 Color" : { + "Red Component" : 0.55686277151107788, + "Color Space" : "Calibrated", + "Blue Component" : 0.48627451062202454, + "Alpha Component" : 1, + "Green Component" : 0.78823530673980713 + }, + "ASCII Ligatures" : false, + "Name" : "Default", + "Cursor Text Color" : { + "Red Component" : 0.90980392694473267, + "Color Space" : "Calibrated", + "Blue Component" : 0.64313727617263794, + "Alpha Component" : 1, + "Green Component" : 0.83137255907058716 + }, + "Minimum Contrast" : 0.30243267276422764, + "Shortcut" : "", + "Cursor Color" : { + "Red Component" : 0.82086181640625, + "Color Space" : "sRGB", + "Blue Component" : 0.25787205621600151, + "Alpha Component" : 1, + "Green Component" : 0.57852262672474808 + }, + "Transparency" : 0, + "Ansi 0 Color" : { + "Red Component" : 0.15686275064945221, + "Color Space" : "Calibrated", + "Blue Component" : 0.15686275064945221, + "Alpha Component" : 1, + "Green Component" : 0.15686275064945221 + }, + "Custom Directory" : "No", + "Ansi 3 Color" : { + "Red Component" : 0.84313726425170898, + "Color Space" : "Calibrated", + "Blue Component" : 0.12941177189350128, + "Alpha Component" : 1, + "Green Component" : 0.60000002384185791 + }, + "Guid" : "A45A9A72-F134-43CD-8E35-C3C946457F5D", + "Right Option Key Sends" : 0, + "Horizontal Spacing" : 1, + "Ansi 7 Color" : { + "Red Component" : 0.65882354974746704, + "Color Space" : "Calibrated", + "Blue Component" : 0.51764708757400513, + "Alpha Component" : 1, + "Green Component" : 0.60000002384185791 + }, + "Ansi 8 Color" : { + "Red Component" : 0.57254904508590698, + "Color Space" : "Calibrated", + "Blue Component" : 0.45490196347236633, + "Alpha Component" : 1, + "Green Component" : 0.51372551918029785 + }, + "Ansi 9 Color" : { + "Red Component" : 0.9843137264251709, + "Color Space" : "Calibrated", + "Blue Component" : 0.20392157137393951, + "Alpha Component" : 1, + "Green Component" : 0.28627452254295349 + }, + "Ansi 4 Color" : { + "Red Component" : 0.27058824896812439, + "Color Space" : "Calibrated", + "Blue Component" : 0.53333336114883423, + "Alpha Component" : 1, + "Green Component" : 0.5215686559677124 + }, + "Ansi 5 Color" : { + "Red Component" : 0.69411766529083252, + "Color Space" : "Calibrated", + "Blue Component" : 0.52549022436141968, + "Alpha Component" : 1, + "Green Component" : 0.38431373238563538 + } +} \ No newline at end of file diff --git a/install/windows/terminal/settings.json b/install/windows/terminal/settings.json new file mode 100755 index 0000000..6dd269c --- /dev/null +++ b/install/windows/terminal/settings.json @@ -0,0 +1,321 @@ +{ + "$schema": "https://aka.ms/terminal-profiles-schema", + "actions": + [ + { + "command": + { + "action": "copy", + "singleLine": false + }, + "keys": "ctrl+c" + }, + { + "command": "paste", + "keys": "ctrl+v" + }, + { + "command": "find", + "keys": "ctrl+shift+f" + }, + { + "command": + { + "action": "splitPane", + "split": "auto", + "splitMode": "duplicate" + }, + "keys": "alt+shift+d" + } + ], + "alwaysShowTabs": true, + "copyFormatting": "none", + "copyOnSelect": true, + "defaultProfile": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}", + "disableAnimations": true, + "initialCols": 80, + "launchMode": "default", + "profiles": + { + "defaults": {}, + "list": + [ + { + "commandline": "powershell.exe", + "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", + "hidden": false, + "name": "Windows PowerShell" + }, + { + "bellStyle": "none", + "closeOnExit": "always", + "colorScheme": "Gruvbox", + "commandline": "C:\\Program Files\\Git\\bin\\bash.exe", + "fontFace": "UbuntuMono NF", + "fontSize": 21, + "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}", + "hidden": false, + "name": "Git-Bash", + "padding": "4", + "scrollbarState": "hidden" + }, + { + "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}", + "hidden": false, + "name": "Azure Cloud Shell", + "source": "Windows.Terminal.Azure" + }, + { + "bellStyle": "none", + "closeOnExit": "always", + "colorScheme": "Gruvbox", + "fontFace": "UbuntuMono NF", + "fontSize": 21, + "guid": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}", + "hidden": false, + "name": "Ubuntu-20.04", + "padding": "5", + "scrollbarState": "hidden", + "source": "Windows.Terminal.Wsl", + "startingDirectory": "%USERPROFILE%" + } + ] + }, + "schemes": + [ + { + "background": "#0C0C0C", + "black": "#0C0C0C", + "blue": "#0037DA", + "brightBlack": "#767676", + "brightBlue": "#3B78FF", + "brightCyan": "#61D6D6", + "brightGreen": "#16C60C", + "brightPurple": "#B4009E", + "brightRed": "#E74856", + "brightWhite": "#F2F2F2", + "brightYellow": "#F9F1A5", + "cursorColor": "#FFFFFF", + "cyan": "#3A96DD", + "foreground": "#CCCCCC", + "green": "#13A10E", + "name": "Campbell", + "purple": "#881798", + "red": "#C50F1F", + "selectionBackground": "#FFFFFF", + "white": "#CCCCCC", + "yellow": "#C19C00" + }, + { + "background": "#012456", + "black": "#0C0C0C", + "blue": "#0037DA", + "brightBlack": "#767676", + "brightBlue": "#3B78FF", + "brightCyan": "#61D6D6", + "brightGreen": "#16C60C", + "brightPurple": "#B4009E", + "brightRed": "#E74856", + "brightWhite": "#F2F2F2", + "brightYellow": "#F9F1A5", + "cursorColor": "#FFFFFF", + "cyan": "#3A96DD", + "foreground": "#CCCCCC", + "green": "#13A10E", + "name": "Campbell Powershell", + "purple": "#881798", + "red": "#C50F1F", + "selectionBackground": "#FFFFFF", + "white": "#CCCCCC", + "yellow": "#C19C00" + }, + { + "background": "#282828", + "black": "#504945", + "blue": "#458588", + "brightBlack": "#928374", + "brightBlue": "#83A598", + "brightCyan": "#8EC07C", + "brightGreen": "#B8BB26", + "brightPurple": "#D3869B", + "brightRed": "#FB4934", + "brightWhite": "#EBDBB2", + "brightYellow": "#FABD2F", + "cursorColor": "#EBDBB2", + "cyan": "#689D6A", + "foreground": "#EBDBB2", + "green": "#98971A", + "name": "Gruvbox", + "purple": "#B16286", + "red": "#CC241D", + "selectionBackground": "#32FFF6", + "white": "#A89984", + "yellow": "#D79921" + }, + { + "background": "#282C34", + "black": "#282C34", + "blue": "#61AFEF", + "brightBlack": "#5A6374", + "brightBlue": "#61AFEF", + "brightCyan": "#56B6C2", + "brightGreen": "#98C379", + "brightPurple": "#C678DD", + "brightRed": "#E06C75", + "brightWhite": "#DCDFE4", + "brightYellow": "#E5C07B", + "cursorColor": "#FFFFFF", + "cyan": "#56B6C2", + "foreground": "#DCDFE4", + "green": "#98C379", + "name": "One Half Dark", + "purple": "#C678DD", + "red": "#E06C75", + "selectionBackground": "#FFFFFF", + "white": "#DCDFE4", + "yellow": "#E5C07B" + }, + { + "background": "#FAFAFA", + "black": "#383A42", + "blue": "#0184BC", + "brightBlack": "#4F525D", + "brightBlue": "#61AFEF", + "brightCyan": "#56B5C1", + "brightGreen": "#98C379", + "brightPurple": "#C577DD", + "brightRed": "#DF6C75", + "brightWhite": "#FFFFFF", + "brightYellow": "#E4C07A", + "cursorColor": "#4F525D", + "cyan": "#0997B3", + "foreground": "#383A42", + "green": "#50A14F", + "name": "One Half Light", + "purple": "#A626A4", + "red": "#E45649", + "selectionBackground": "#FFFFFF", + "white": "#FAFAFA", + "yellow": "#C18301" + }, + { + "background": "#002B36", + "black": "#002B36", + "blue": "#268BD2", + "brightBlack": "#073642", + "brightBlue": "#839496", + "brightCyan": "#93A1A1", + "brightGreen": "#586E75", + "brightPurple": "#6C71C4", + "brightRed": "#CB4B16", + "brightWhite": "#FDF6E3", + "brightYellow": "#657B83", + "cursorColor": "#FFFFFF", + "cyan": "#2AA198", + "foreground": "#839496", + "green": "#859900", + "name": "Solarized Dark", + "purple": "#D33682", + "red": "#DC322F", + "selectionBackground": "#FFFFFF", + "white": "#EEE8D5", + "yellow": "#B58900" + }, + { + "background": "#FDF6E3", + "black": "#002B36", + "blue": "#268BD2", + "brightBlack": "#073642", + "brightBlue": "#839496", + "brightCyan": "#93A1A1", + "brightGreen": "#586E75", + "brightPurple": "#6C71C4", + "brightRed": "#CB4B16", + "brightWhite": "#FDF6E3", + "brightYellow": "#657B83", + "cursorColor": "#002B36", + "cyan": "#2AA198", + "foreground": "#657B83", + "green": "#859900", + "name": "Solarized Light", + "purple": "#D33682", + "red": "#DC322F", + "selectionBackground": "#FFFFFF", + "white": "#EEE8D5", + "yellow": "#B58900" + }, + { + "background": "#000000", + "black": "#000000", + "blue": "#3465A4", + "brightBlack": "#555753", + "brightBlue": "#729FCF", + "brightCyan": "#34E2E2", + "brightGreen": "#8AE234", + "brightPurple": "#AD7FA8", + "brightRed": "#EF2929", + "brightWhite": "#EEEEEC", + "brightYellow": "#FCE94F", + "cursorColor": "#FFFFFF", + "cyan": "#06989A", + "foreground": "#D3D7CF", + "green": "#4E9A06", + "name": "Tango Dark", + "purple": "#75507B", + "red": "#CC0000", + "selectionBackground": "#FFFFFF", + "white": "#D3D7CF", + "yellow": "#C4A000" + }, + { + "background": "#FFFFFF", + "black": "#000000", + "blue": "#3465A4", + "brightBlack": "#555753", + "brightBlue": "#729FCF", + "brightCyan": "#34E2E2", + "brightGreen": "#8AE234", + "brightPurple": "#AD7FA8", + "brightRed": "#EF2929", + "brightWhite": "#EEEEEC", + "brightYellow": "#FCE94F", + "cursorColor": "#000000", + "cyan": "#06989A", + "foreground": "#555753", + "green": "#4E9A06", + "name": "Tango Light", + "purple": "#75507B", + "red": "#CC0000", + "selectionBackground": "#FFFFFF", + "white": "#D3D7CF", + "yellow": "#C4A000" + }, + { + "background": "#000000", + "black": "#000000", + "blue": "#000080", + "brightBlack": "#808080", + "brightBlue": "#0000FF", + "brightCyan": "#00FFFF", + "brightGreen": "#00FF00", + "brightPurple": "#FF00FF", + "brightRed": "#FF0000", + "brightWhite": "#FFFFFF", + "brightYellow": "#FFFF00", + "cursorColor": "#FFFFFF", + "cyan": "#008080", + "foreground": "#C0C0C0", + "green": "#008000", + "name": "Vintage", + "purple": "#800080", + "red": "#800000", + "selectionBackground": "#FFFFFF", + "white": "#C0C0C0", + "yellow": "#808000" + } + ], + "showTabsInTitlebar": true, + "showTerminalTitleInTitlebar": false, + "startOnUserLogin": true, + "theme": "dark" +} \ No newline at end of file diff --git a/lynx/README.md b/lynx/README.md new file mode 100644 index 0000000..8eca7cb --- /dev/null +++ b/lynx/README.md @@ -0,0 +1,19 @@ +# Lynx Text Browser FTW! + +*New and Improved! You can now test this as a [container]:* + +``` +docker run -it --rm rwxrob/lynx +``` + +It might be the oldest web browser currently under active maintenance +but it is still hands down the single best browser for rapid research. +Lynx does not even look at the bloat of images, CSS, and JavaScript when +loading making it objectively the fastest possible way to browse the +text of web sites. When combined with a `?` (`duck`) and `??` (`google`) +command you fill find results to documentation queries and technical +documentation as fast as it takes to open a local `man` page. + +## Install + +Run the `./setup` to diff --git a/lynx/lynx.cfg b/lynx/lynx.cfg new file mode 100644 index 0000000..5c89be1 --- /dev/null +++ b/lynx/lynx.cfg @@ -0,0 +1,3835 @@ +# $LynxId: lynx.cfg,v 1.302 2018/07/08 15:22:44 tom Exp $ +# lynx.cfg file. +# The default placement for this file is /usr/local/lib/lynx.cfg (Unix) +# or Lynx_Dir:lynx.cfg (VMS) +# +# $Format: "#PRCS LYNX_VERSION \"$ProjectVersion$\""$ +#PRCS LYNX_VERSION "2.8.9rel.1" +# +# $Format: "#PRCS LYNX_DATE \"$ProjectDate$\""$ +#PRCS LYNX_DATE "Sun, 08 Jul 2018 06:46:06 -0400" +# +# Definition pairs (configuration settings) are of the form +# VARIABLE:DEFINITION +# NO spaces are allowed around the colon ":" between the pair items. +# +# If you do not have write access to /usr/local/lib you may change +# the default location of this file in the userdefs.h file and recompile, +# or specify its location on the command line with the "-cfg" +# command line option. +# +# Items may be commented out by putting a '#' as the FIRST char of the line +# (Any line beginning with punctuation is ignored). Leading blanks on each +# line are ignored; trailing blanks may be significant depending on the option. + +# In most cases, a definition can be overridden by another later in the +# file, or in an including configuration file. You can see the effect of +# definitions (and redefinitions) in the trace file Lynx.log by using the +# "-trace" and "-trace-mask" options, e.g., +# lynx -trace -trace-mask=8 + +# As a documentation aid, the default values for each setting are shown +# commented-out. By convention, these default value comments have no space +# after the "#", e.g., +# #HTTP_PROTOCOL:1.0 + +# An HTML'ized description of all settings (based on comments in this file, +# with alphabetical table of settings and with table of settings by category) +# is available at https://lynx.invisible-island.net/release/breakout/lynx_help/cattoc.html +# +### The conversion is done via the scripts/cfg2html.pl script. +### Several directives beginning with '.' are used for this purpose. + +.h1 Auxiliary Facilities +# These settings control the auxiliary navigating facilities of lynx, e.g., +# jumpfiles, bookmarks, default URLs. + +.h2 INCLUDE +# Starting with Lynx 2.8.1, the lynx.cfg file has a crude "include" +# facility. This means that you can take advantage of the global lynx.cfg +# while also supplying your own tweaks. +# +# You can use a command-line argument (-cfg /where/is/lynx.cfg) or an +# environment variable (LYNX_CFG=/where/is/lynx.cfg). +# For instance, put in your .profile or .login: +# +# LYNX_CFG=~/lynx.cfg; export LYNX_CFG # in .profile for sh/ksh/bash/etc. +# setenv LYNX_CFG ~/lynx.cfg # in .login for [t]csh +# +# Then in ~/lynx.cfg: +# +# INCLUDE:/usr/local/lib/lynx.cfg +# ^^^^^^^^^^^^^^^^^^^^^^^ or whatever is appropriate on your system +# and now your own tweaks. If you omit the directory name, e.g., +# +# INCLUDE:lynx.cfg +# +# then lynx first checks if it is in any of the directories listed in the +# environment variable LYNX_CFG_PATH, then tries the directory of the default +# config-file. +# +# You can also suppress all but specific settings that will be read from +# included files. This allows sysadmins to provide users the ability to +# customize lynx with options that normally do not affect security, such as +# COLOR, VIEWER, KEYMAP. +# +# The syntax is +# +# INCLUDE:filename for +# +# sample: +.ex +#INCLUDE:~/lynx.cfg for COLOR VIEWER KEYMAP +# only one space character should surround the word 'for'. On Unix systems ':' +# is also accepted as separator. In that case, the example can be written as +.ex +#INCLUDE:~/lynx.cfg:COLOR VIEWER KEYMAP +# In the example, only the settings COLOR, VIEWER and KEYMAP are accepted by +# lynx. Other settings are ignored. Note: INCLUDE is also treated as a +# setting, so to allow an included file to include other files, put INCLUDE in +# the list of allowed settings. +# +# If you allow an included file to include other files, and if a list of +# allowed settings is specified for that file with the INCLUDE command, nested +# files are only allowed to include the list of settings that is the set AND of +# settings allowed for the included file and settings allowed by nested INCLUDE +# commands. In short, there is no security hole introduced by including a +# user-defined configuration file if the original list of allowed settings is +# secure. + +.h2 STARTFILE +# STARTFILE is the default starting URL if none is specified +# on the command line or via a WWW_HOME environment variable; +# Lynx will refuse to start without a starting URL of some kind. +# STARTFILE can be remote, e.g. http://www.w3.org/default.html , +# or local, e.g. file://localhost/PATH_TO/FILENAME , +# where PATH_TO is replaced with the complete path to FILENAME +# using Unix shell syntax and including the device on VMS. +# +# Normally we expect you will connect to a remote site, e.g., the Lynx starting +# site: +STARTFILE:https://rwx.gg +# +# As an alternative, you may want to use a local URL. A good choice for this is +# the user's home directory: +.ex +#STARTFILE:file://localhost/~/ +# +# Your choice of STARTFILE should reflect your site's needs, and be a URL that +# you can connect to reliably. Otherwise users will become confused and think +# that they cannot run Lynx. + +.h2 HELPFILE +# HELPFILE must be defined as a URL and must have a +# complete path if local: +# file://localhost/PATH_TO/lynx_help/lynx_help_main.html +# Replace PATH_TO with the path to the lynx_help subdirectory +# for this distribution (use SHELL syntax including the device +# on VMS systems). +# The default HELPFILE is: +.url https://lynx.invisible-island.net/lynx_help/lynx_help_main.html +# This should be changed to the local path. +# This definition will be overridden if the "LYNX_HELPFILE" environment +# variable has been set. +# +HELPFILE:https://lynx.invisible-island.net/lynx_help/lynx_help_main.html +.ex +#HELPFILE:file://localhost/PATH_TO/lynx_help/lynx_help_main.html + +.h2 DEFAULT_INDEX_FILE +# DEFAULT_INDEX_FILE is the default file retrieved when the +# user presses the 'I' key when viewing any document. +# An index to your CWIS can be placed here or a document containing +# pointers to lots of interesting places on the web. +# +DEFAULT_INDEX_FILE:https://duckduckgo.com/lite + +.h1 Interaction + +.h2 GOTOBUFFER +# Set GOTOBUFFER to TRUE if you want to have the previous goto URL, +# if any, offered for reuse or editing when using the 'g'oto command. +# The default is defined in userdefs.h. If left FALSE, the circular +# buffer of previously entered goto URLs can still be invoked via the +# Up-Arrow or Down-Arrow keys after entering the 'g'oto command. +# +#GOTOBUFFER:FALSE + +.h2 JUMP_PROMPT +# JUMP_PROMPT is the default statusline prompt for selecting a jumps file +# shortcut. (see below). +# You can change the prompt here from that defined in userdefs.h. Any +# trailing white space will be trimmed, and a single space is added by Lynx +# following the last non-white character. You must set the default prompt +# before setting the default jumps file (below). If a default jumps file +# was set via userdefs.h, and you change the prompt here, you must set the +# default jumps file again (below) for the change to be implemented. +# +#JUMP_PROMPT:Jump to (use '?' for list): + +.h1 Auxiliary Facilities + +.h2 JUMPFILE +# JUMPFILE is the local file checked for short-cut names for URLs when +# the user presses the 'j' (JUMP) key. The file contains an HTML +# definition list (DL). The definition titles (DT) are used as +# short-cut name; the definition data (DD) are URLs. +# +# There is an example jumps file in the samples subdirectory. +# +# After pressing 'j', the user will be prompted to enter a short-cut +# name for an URL, which Lynx will then follow in a similar manner to +# 'g'oto; alternatively, s/he can enter '?' to view the full JUMPFILE +# list of short-cuts with associated URLs. +# +# If the URL contains one or more "%s" markers, Lynx will prompt the user +# for text to fill in for each marker. If no text is given, the jump is +# cancelled. +# +# If not defined here or in userdefs.h, the JUMP command will invoke the +# NO_JUMPFILE statusline message (see LYMessages_en.h ). +# +# To allow '?' to work, include in the JUMPFILE +# a short-cut to the JUMPFILE itself, e.g. +#
?
This Shortcut List +# +# On VMS, use Unix SHELL syntax (including a lead slash) to define it. +# +# Alternate jumps files can be defined and mapped to keys here. If the +# keys have already been mapped, then those mappings will be replaced, +# but you should leave at least one key mapped to the default jumps +# file. You optionally may include a statusline prompt string for the +# mapping. You must map upper and lowercase keys separately (beware of +# mappings to keys which the user can further remap via the 'o'ptions +# menu). The format is: +# +# JUMPFILE:path:key[:prompt] +# +# where path should begin with a '/' (i.e., not include file://localhost). +# Any white space following a prompt string will be trimmed, and a single +# space will be added by Lynx. +# +# In the following line, include the actual full local path to JUMPFILE, +# but do not include 'file://localhost' in the line. +#JUMPFILE:/FULL_LOCAL_PATH/jumps.html +.ex +#JUMPFILE:/Lynx_Dir/ips.html:i:IP or Interest group (? for list): + +.h2 JUMPBUFFER +# Set JUMPBUFFER to TRUE if you want to have the previous jump target, +# if any, offered for reuse or editing when using the 'J'ump command. +# The default is defined in userdefs.h. If left FALSE, the circular +# buffer of previously entered targets (shortcuts) can still be invoked +# via the Up-Arrow or Down-Arrow keys after entering the 'J'ump command. +# If multiple jumps files are installed, the recalls of shortcuts will +# be specific to each file. If Lynx was built with PERMIT_GOTO_FROM_JUMP +# defined, any random URLs used instead of shortcuts will be stored in the +# goto URL buffer, not in the shortcuts buffer(s), and the single character +# ':' can be used as a target to invoke the goto URL buffer (as if 'g'oto +# followed by Up-Arrow had been entered). +# +#JUMPBUFFER:FALSE + +.h1 Internal Behavior + +.h2 SAVE_SPACE +# If SAVE_SPACE is defined, it will be used as a path prefix for the +# suggested filename in "Save to Disk" operations from the 'p'rint or +# 'd'ownload menus. On VMS, you can use either VMS (e.g., "SYS$LOGIN:") +# or Unix syntax (including '~' for the HOME directory). On Unix, you +# must use Unix syntax. If the symbol is not defined, or is zero-length +# (""), no prefix will be used, and only a filename for saving in the +# current default directory will be suggested. +# This definition will be overridden if a "LYNX_SAVE_SPACE" environment +# variable has been set on Unix, or logical has been defined on VMS. +# +#SAVE_SPACE:~/foo/ + +.h2 REUSE_TEMPFILES +# Lynx uses temporary files for (among other purposes) the content of +# various user interface pages. REUSE_TEMPFILES changes the behavior +# for some of these temp files, among them pages shown for HISTORY, +# VLINKS, OPTIONS, INFO, PRINT, DOWNLOAD commands. +# If set to TRUE, the same file can be used multiple times for the same +# purpose. If set to FALSE, a new filename is generated each time before +# rewriting such a page. With TRUE, repeated invocation of these commands +# is less likely to push previous documents out of the cache of rendered +# texts (see also DEFAULT_CACHE_SIZE). This is especially useful with +# intermittent (dialup) network connections, when it is desirable to +# continue browsing through the cached documents after disconnecting. +# With the default setting of FALSE, there can be more than one incarnation +# of e.g. the VLINKS page cached in memory (but still only the most recently +# generated one is kept as a file), resulting in sometimes less surprising +# behaviour when returning to such a page via HISTORY or PREV_DOC functions +# (most users will not encounter and notice this difference). +# +#REUSE_TEMPFILES:FALSE + +.h2 LYNX_HOST_NAME +# If LYNX_HOST_NAME is defined here or in userdefs.h, it will be +# treated as an alias for the local host name in checks for URLs on +# the local host (e.g., when the -localhost switch is set), and this +# host name, "localhost", and HTHostName (the fully qualified domain +# name of the system on which Lynx is running) will all be passed as +# local. A different definition here will override that in userdefs.h. +# +#LYNX_HOST_NAME:www.cc.ukans.edu + +.h2 LOCALHOST_ALIAS +# localhost aliases +# Any LOCALHOST_ALIAS definitions also will be accepted as local when +# the -localhost switch is set. These need not actually be local, i.e., +# in contrast to LYNX_HOST_NAME, you can define them to trusted hosts at +# other Internet sites. +# +.ex 2 +#LOCALHOST_ALIAS:gopher.server.domain +#LOCALHOST_ALIAS:news.server.domain + +.h2 LOCAL_DOMAIN +# LOCAL_DOMAIN is used for a tail match with the ut_host element of +# the utmp or utmpx structure on systems with utmp capabilities, to +# determine if a user is local to your campus or organization when +# handling -restrictions=inside_foo or outside_foo settings for ftp, +# news, telnet/tn3270 and rlogin URLs. An "inside" user is assumed +# if your system does not have utmp capabilities. CHANGE THIS here +# if it was not changed in userdefs.h at compilation time. +# +#LOCAL_DOMAIN:ukans.edu + +.h1 Session support + +.h2 AUTO_SESSION +# If AUTO_SESSION is TRUE lynx will save/restore useful information about +# your browsing history when closing/starting current lynx session if +# no command-line session switches override this setting. +# This setting is useful only if SESSION_FILE is defined here or in the user's +# .lynxrc file. +# +#AUTO_SESSION:FALSE + +.h2 SESSION_FILE +# SESSION_FILE defines the file name where lynx will store user sessions. +# This setting is used only when AUTO_SESSION is true. +# Note: the default setting will store/resume each session in a different +# folder under same file name (if that is allowed by operating system) +# when lynx is invoked from different directories. +# (The current working directory may be changed inside lynx) +# +# If you want to use the same session file wherever you invoke Lynx, +# enter the full path below, eg '/home//.lynx_session'. +# +# If you do not want this feature, leave the setting commented. +# Users can still customize SESSION_FILE and AUTO_SESSION via +# their .lynxrc file. +# +#SESSION_FILE:lynx_session + +.h2 SESSION_LIMIT +# SESSION_LIMIT defines maximum number of: searched strings, goto URLs, +# visited links and history entries which will be saved in session file. The +# minimum allowed is 1, the maximum is 10000. +# +# For instance, if SESSION_LIMIT is 250, a per-session limit of 250 entries of +# searched strings, goto URLs, visited links and history entries will be saved +# in the session file. +# +# There is no fixed limit on the number of entries which can be restored; +# It is limited only by available memory. +# +#SESSION_LIMIT:250 + +.h1 Character Sets + +.h2 CHARACTER_SET +# CHARACTER_SET defines the display character set, i.e., assumed to be +# installed on the user's terminal. It determines which characters or strings +# will be used to represent 8-bit character entities within HTML. New +# character sets may be defined as explained in the README files of the +# src/chrtrans directory in the Lynx source code distribution. For Asian (CJK) +# character sets, it also determines how Kanji code will be handled. The +# default is defined in userdefs.h and can be changed here or via the +# 'o'ptions menu. The 'o'ptions menu setting will be stored in the user's RC +# file whenever those settings are saved, and thereafter will be used as the +# default. For Lynx a "character set" has two names: a MIME name (for +# recognizing properly labeled charset parameters in HTTP headers etc.), and a +# human-readable string for the 'O'ptions Menu (so you may find info about +# language or group of languages besides MIME name). Not all 'human-readable' +# names correspond to exactly one valid MIME charset (example is "Chinese"); +# in that case an appropriate valid (and more specific) MIME name should be +# used where required. Well-known synonyms are also processed in the code. +# +# Raw (CJK) mode +# +# Lynx normally translates characters from a document's charset to display +# charset, using ASSUME_CHARSET value (see below) if the document's charset +# is not specified explicitly. Raw (CJK) mode is OFF for this case. +# When the document charset is specified explicitly, that charset +# overrides any assumption like ASSUME_CHARSET or raw (CJK) mode. +# +# For the Asian (CJK) display character sets, the corresponding charset is +# assumed in documents, i.e., raw (CJK) mode is ON by default. In raw CJK +# mode, 8-bit characters are not reverse translated in relation to the entity +# conversion arrays, i.e., they are assumed to be appropriate for the display +# character set. The mode should be toggled OFF when an Asian (CJK) display +# character set is selected but the document is not CJK and its charset not +# specified explicitly. +# +# Raw (CJK) mode may be toggled by user via '@' (LYK_RAW_TOGGLE) key, +# the -raw command line switch or from the 'o'ptions menu. +# +# Raw (CJK) mode effectively changes the charset assumption about unlabeled +# documents. You can toggle raw mode ON if you believe the document has a +# charset which does correspond to your Display Character Set. On the other +# hand, if you set ASSUME_CHARSET the same as Display Character Set you get raw +# mode ON by default (but you get assume_charset=iso-8859-1 if you try raw mode +# OFF after it). +# +# Note that "raw" does not mean that every byte will be passed to the screen. +# HTML character entities may get expanded and translated, inappropriate +# control characters filtered out, etc. There is a "Transparent" pseudo +# character set for more "rawness". +# +# Since Lynx now supports a wide range of platforms it may be useful to note +# the cpXXX codepages used by IBM PC compatible computers, and windows-xxxx +# used by native MS-Windows apps. We also note that cpXXX pages rarely are +# found on Internet, but are mostly for local needs on DOS. +# +# Recognized character sets include: +# +.nf +# string for 'O'ptions Menu MIME name +# =========================== ========= +# 7 bit approximations (US-ASCII) us-ascii +# Western (ISO-8859-1) iso-8859-1 +# Western (ISO-8859-15) iso-8859-15 +# Western (cp850) cp850 +# Western (windows-1252) windows-1252 +# IBM PC US codepage (cp437) cp437 +# DEC Multinational dec-mcs +# Macintosh (8 bit) macintosh +# NeXT character set next +# HP Roman8 hp-roman8 +# Chinese euc-cn +# Japanese (EUC-JP) euc-jp +# Japanese (Shift_JIS) shift_jis +# Korean euc-kr +# Taipei (Big5) big5 +# Vietnamese (VISCII) viscii +# Eastern European (ISO-8859-2) iso-8859-2 +# Eastern European (cp852) cp852 +# Eastern European (windows-1250) windows-1250 +# Latin 3 (ISO-8859-3) iso-8859-3 +# Latin 4 (ISO-8859-4) iso-8859-4 +# Baltic Rim (ISO-8859-13) iso-8859-13 +# Baltic Rim (cp775) cp775 +# Baltic Rim (windows-1257) windows-1257 +# Celtic (ISO-8859-14) iso-8859-14 +# Cyrillic (ISO-8859-5) iso-8859-5 +# Cyrillic (cp866) cp866 +# Cyrillic (windows-1251) windows-1251 +# Cyrillic (KOI8-R) koi8-r +# Arabic (ISO-8859-6) iso-8859-6 +# Arabic (cp864) cp864 +# Arabic (windows-1256) windows-1256 +# Greek (ISO-8859-7) iso-8859-7 +# Greek (cp737) cp737 +# Greek2 (cp869) cp869 +# Greek (windows-1253) windows-1253 +# Hebrew (ISO-8859-8) iso-8859-8 +# Hebrew (cp862) cp862 +# Hebrew (windows-1255) windows-1255 +# Turkish (ISO-8859-9) iso-8859-9 +# North European (ISO-8859-10) iso-8859-10 +# Ukrainian Cyrillic (cp866u) cp866u +# Ukrainian Cyrillic (KOI8-U) koi8-u +# UNICODE (UTF-8) utf-8 +# RFC 1345 w/o Intro mnemonic+ascii+0 +# RFC 1345 Mnemonic mnemonic +# Transparent x-transparent +.fi +# +# The value should be the MIME name of a character set recognized by +# Lynx (case insensitive). +# Find RFC 1345 at +.url http://tools.ietf.org/html/rfc1345 +# +CHARACTER_SET:iso-8859-1 + +.h2 LOCALE_CHARSET +# LOCALE_CHARSET overrides CHARACTER_SET if true, using the current locale to +# lookup a MIME name that corresponds, and use that as the display charset. +# +# It also modifies the default value for ASSUME_CHARSET; it does not override +# that setting. +# +# Note that while nl_langinfo(CODESET) itself is standardized, the return +# values and their relationship to the locale value is not. GNU libiconv +# happens to give useful values, but other implementations are not guaranteed +# to do this. +#LOCALE_CHARSET:FALSE +LOCALE_CHARSET:TRUE + +.h2 HTML5_CHARSETS +# HTML5_CHARSETS is an alternative to ASSUME_CHARSET and ASSUME_LOCAL_CHARSET. +# Those assume by default that the character set of an HTML document is (as is +# standard in HTML4) ISO-8859-1, in the absence of locale information. +# +# HTML5 introduces a "compatibility" (sic) feature which assumes that the +# default is Windows 1252. In the same way, it equates ISO-8859-4 and Windows +# 1254. Finally, it also makes recommendations which selectively reinterpret +# the locale encoding. +# +# This option currently implements only the equating of ISO-8859-1 and Windows +# 1252. +# +#HTML5_CHARSETS:FALSE + +.h2 ASSUME_CHARSET +# ASSUME_CHARSET changes the handling of documents which do not +# explicitly specify a charset. Normally Lynx assumes that 8-bit +# characters in those documents are encoded according to iso-8859-1 +# (the official default for the HTTP protocol). When ASSUME_CHARSET +# is defined here or by an -assume_charset command line flag is in effect, +# Lynx will treat documents as if they were encoded accordingly. +# See above on how this interacts with "raw mode" and the Display +# Character Set. +# ASSUME_CHARSET can also be changed via the 'o'ptions menu but will +# not be saved as permanent value in user's .lynxrc file to avoid more chaos. +# +#ASSUME_CHARSET:iso-8859-1 + +.h2 ASSUMED_DOC_CHARSET_CHOICE +.h2 DISPLAY_CHARSET_CHOICE +# It is possible to reduce the number of charset choices in the 'O'ptions menu +# for "display charset" and "assumed document charset" fields via +# DISPLAY_CHARSET_CHOICE and ASSUMED_DOC_CHARSET_CHOICE settings correspondingly. +# Each of these settings can be used several times to define the set of possible +# choices for corresponding field. The syntax for the values is +# +# string | prefix* | * +# +# where +# +# 'string' is either the MIME name of charset or it's full name (listed +# either in the left or in the right column of table of +# recognized charsets), case-insensitive - e.g. 'Koi8-R' or +# 'Cyrillic (KOI8-R)' (both without quotes), +# +# 'prefix' is any string, and such value will select all charsets having +# the name with prefix matching given (case insensitive), i.e., +# for the charsets listed in the table of recognized charsets, +# +.ex +# ASSUMED_DOC_CHARSET_CHOICE:cyrillic* +# will be equal to specifying +.ex 4 +# ASSUMED_DOC_CHARSET_CHOICE:cp866 +# ASSUMED_DOC_CHARSET_CHOICE:windows-1251 +# ASSUMED_DOC_CHARSET_CHOICE:koi8-r +# ASSUMED_DOC_CHARSET_CHOICE:iso-8859-5 +# or lines with full names of charsets. +# +# literal string '*' (without quotes) will enable all charset choices +# in corresponding field. This is useful for overriding site +# defaults in private pieces of lynx.cfg included via INCLUDE +# directive. +# +# Default values for both settings are '*', but any occurrence of settings +# with values that denote any charsets will make only listed choices available +# for corresponding field. +#ASSUMED_DOC_CHARSET_CHOICE:* +#DISPLAY_CHARSET_CHOICE:* + +.h2 ASSUME_LOCAL_CHARSET +# ASSUME_LOCAL_CHARSET is like ASSUME_CHARSET but only applies to local +# files. If no setting is given here or by an -assume_local_charset +# command line option, the value for ASSUME_CHARSET or -assume_charset +# is used. It works for both text/plain and text/html files. +# This option will ignore "raw mode" toggling when local files are viewed +# (it is "stronger" than "assume_charset" or the effective change +# of the charset assumption caused by changing "raw mode"), +# so only use when necessary. +# +#ASSUME_LOCAL_CHARSET:iso-8859-1 + +.h2 PREPEND_CHARSET_TO_SOURCE +# PREPEND_CHARSET_TO_SOURCE:TRUE tells Lynx to prepend a META CHARSET line +# to text/html source files when they are retrieved for 'd'ownloading +# or passed to 'p'rint functions, so HTTP headers will not be lost. +# This is necessary for resolving charset for local html files, +# while the assume_local_charset is just an assumption. +# For the 'd'ownload option, a META CHARSET will be added only if the HTTP +# charset is present. The compilation default is TRUE. +# It is generally desirable to have charset information for every local +# html file, but META CHARSET string potentially could cause +# compatibility problems with other browsers, see also PREPEND_BASE_TO_SOURCE. +# Note that the prepending is not done for -source dumps. +# +PREPEND_CHARSET_TO_SOURCE:FALSE + +.h2 NCR_IN_BOOKMARKS +# NCR_IN_BOOKMARKS:TRUE allows you to save 8-bit characters in bookmark titles +# in the unicode format (NCR). This may be useful if you need to switch +# display charsets frequently. This is the case when you use Lynx on different +# platforms, e.g., on UNIX and from a remote PC, and want to keep the bookmarks +# file persistent. +# Another aspect is compatibility: NCR is part of I18N and HTML4.0 +# specifications supported starting with Lynx 2.7.2, Netscape 4.0 and MSIE 4.0. +# Older browser versions will fail so keep NCR_IN_BOOKMARKS:FALSE if you +# plan to use them. +# +#NCR_IN_BOOKMARKS:FALSE + +.h2 FORCE_8BIT_TOUPPER +# FORCE_8BIT_TOUPPER overrides locale settings and uses internal 8-bit +# case-conversion mechanism for case-insensitive searches in non-ASCII display +# character sets. It is FALSE by default and should not be changed unless +# you encounter problems with case-insensitive searches. +# +#FORCE_8BIT_TOUPPER:FALSE + +.h2 OUTGOING_MAIL_CHARSET +# While Lynx supports different platforms and display character sets +# we need to limit the charset in outgoing mail to reduce +# trouble for remote recipients who may not recognize our charset. +# You may try US-ASCII as the safest value (7 bit), any other MIME name, +# or leave this field blank (default) to use the display character set. +# Charset translations currently are implemented for mail "subjects= " only. +# +#OUTGOING_MAIL_CHARSET: + +.h2 ASSUME_UNREC_CHARSET +# If Lynx encounters a charset parameter it doesn't recognize, it will +# replace the value given by ASSUME_UNREC_CHARSET (or a corresponding +# -assume_unrec_charset command line option) for it. This can be used +# to deal with charsets unknown to Lynx, if they are "sufficiently +# similar" to one that Lynx does know about, by forcing the same +# treatment. There is no default, and you probably should leave this +# undefined unless necessary. +# +#ASSUME_UNREC_CHARSET:iso-8859-1 + +.h2 PREFERRED_LANGUAGE +# PREFERRED_LANGUAGE is the language in MIME notation (e.g., "en", +# "fr") which will be indicated by Lynx in its Accept-Language headers +# as the preferred language. If available, the document will be +# transmitted in that language. Users can override this setting via +# the 'o'ptions menu and save that preference in their RC file. +# This may be a comma-separated list of languages in decreasing preference. +# +PREFERRED_LANGUAGE:en + +.h2 PREFERRED_CHARSET +# PREFERRED_CHARSET specifies the character set in MIME notation (e.g., +# "ISO-8859-2", "ISO-8859-5") which Lynx will indicate you prefer in +# requests to http servers using an Accept-Charsets header. Users can +# change it via the 'o'ptions menu and save that preference in their RC file. +# The value should NOT include "ISO-8859-1" or "US-ASCII", +# since those values are always assumed by default. +# If a file in that character set is available, the server will send it. +# If no Accept-Charset header is present, the default is that any +# character set is acceptable. If an Accept-Charset header is present, +# and if the server cannot send a response which is acceptable +# according to the Accept-Charset header, then the server SHOULD send +# an error response with the 406 (not acceptable) status code, though +# the sending of an unacceptable response is also allowed. See RFC 2068 +.url http://tools.ietf.org/html/rfc2068 +# +#PREFERRED_CHARSET: + +.h2 CHARSETS_DIRECTORY +# CHARSETS_DIRECTORY specifies the directory with the fonts (glyph data) +# used by Lynx to switch the display-font to a font best suited for the +# given document. The font should be in a format understood by the +# platforms TTY-display-font-switching API. Currently supported on OS/2 only. +# +# Lynx expects the glyphs for the charset CHARSET with character cell +# size HHHxWWW to be stored in a file HHHxWWW/CHARSET.fnt inside the directory +# specified by CHARSETS_DIRECTORY. E.g., the font for koi8-r sized 14x9 +# should be in the file 14x9/koi8-r.fnt. +# +#CHARSETS_DIRECTORY: + +.h2 CHARSET_SWITCH_RULES +# CHARSET_SWITCH_RULES hints lynx on how to choose the best display font given +# the document encoding. This string is a sequence of chunks, each chunk +# having the following form: +# +# IN_CHARSET1 IN_CHARSET2 ... IN_CHARSET5 :OUT_CHARSET +# +# For readability, one may insert arbitrary additional punctuation (anything +# but : is ignored). E.g., if lynx is able to switch only to display charsets +# cp866, cp850, cp852, and cp862, then the following setting may be useful +# (split for readability): +# +# CHARSET_SWITCH_RULES: koi8-r ISO-8859-5 windows-1251 cp866u KOI8-U :cp866, +# iso-8859-1 windows-1252 ISO-8859-15 :cp850, +# ISO-8859-2 windows-1250 :cp852, +# ISO-8859-8 windows-1255 :cp862 +# +#CHARSET_SWITCH_RULES: + +.h1 Interaction + +.h2 URL_DOMAIN_PREFIXES +.h2 URL_DOMAIN_SUFFIXES +# URL_DOMAIN_PREFIXES and URL_DOMAIN_SUFFIXES are strings which will be +# prepended (together with a scheme://) and appended to the first element +# of command line or 'g'oto arguments which are not complete URLs and +# cannot be opened as a local file (file://localhost/string). Both +# can be comma-separated lists. Each prefix must end with a dot, each +# suffix must begin with a dot, and either may contain other dots (e.g., +# .com.jp). The default lists are defined in userdefs.h and can be +# replaced here. Each prefix will be used with each suffix, in order, +# until a valid Internet host is created, based on a successful DNS +# lookup (e.g., foo will be tested as www.foo.com and then www.foo.edu +# etc.). The first element can include a :port and/or /path which will +# be restored with the expanded host (e.g., wfbr:8002/dir/lynx will +# become http://www.wfbr.edu:8002/dir/lynx). The prefixes will not be +# used if the first element ends in a dot (or has a dot before the +# :port or /path), and similarly the suffixes will not be used if the +# the first element begins with a dot (e.g., .nyu.edu will become +# http://www.nyu.edu without testing www.nyu.com). Lynx will try to +# guess the scheme based on the first field of the expanded host name, +# and use "http://" as the default (e.g., gopher.wfbr.edu or gopher.wfbr. +# will be made gopher://gopher.wfbr.edu). +# +#URL_DOMAIN_PREFIXES:www. +#URL_DOMAIN_SUFFIXES:.com,.edu,.net,.org + +.h2 FORMS_OPTIONS +# Toggle whether the Options Menu is key-based or form-based; +# the key-based version is available only if specified at compile time. +#FORMS_OPTIONS:TRUE + +.h2 PARTIAL +# Display partial pages while downloading +#PARTIAL:TRUE + +.h2 PARTIAL_THRES +# Set the threshold # of lines Lynx must render before it +# redraws the screen in PARTIAL mode. Anything < 0 implies +# use of the screen size. +#PARTIAL_THRES:-1 + +.h2 SHOW_KB_RATE +# While getting large files, Lynx shows the approximate rate of transfer. +# Set this to change the units shown. "Kilobytes" denotes 1024 bytes: +# NONE to disable the display of transfer rate altogether. +# TRUE or KB for Kilobytes/second. +# FALSE or BYTES for bytes/second. +# KB,ETA to show Kilobytes/second with estimated completion time. +# BYTES,ETA to show BYTES/second with estimated completion time. +# KB2,ETA to show Kilobytes/second with estimated completion time using 2-digits. +# BYTES2,ETA to show BYTES/second with estimated completion time using 2-digits. +# Note that the "ETA" values are available if USE_READPROGRESS was defined. +#SHOW_KB_RATE:TRUE + +.h2 SHOW_KB_NAME +# Set the abbreviation for Kilobytes (1024). +# Quoting from +.url http://www.romulus2.com/articles/guides/misc/bitsbytes.shtml +# In December 1998, the International Electrotechnical Commission (IEC) +# approved a new IEC International Standard. Instead of using the metric +# prefixes for multiples in binary code, the new IEC standard invented specific +# prefixes for binary multiples made up of only the first two letters of the +# metric prefixes and adding the first two letters of the word "binary". Thus, +# for instance, instead of Kilobyte (KB) or Gigabyte (GB), the new terms would +# be kibibyte (KiB) or gibibyte (GiB). +# +# If you prefer using the conventional (and more common) "KB", modify this +# setting. +#SHOW_KB_NAME:KiB + +.h1 Timeouts + +.h2 INFOSECS +.h2 MESSAGESECS +.h2 ALERTSECS +.h2 NO_PAUSE +# The following definitions set the number of seconds for +# pauses following statusline messages that would otherwise be +# replaced immediately, and are more important than the unpaused +# progress messages. Those set by INFOSECS are also basically +# progress messages (e.g., that a prompted input has been canceled) +# and should have the shortest pause. Those set by MESSAGESECS are +# informational (e.g., that a function is disabled) and should have +# a pause of intermediate duration. Those set by ALERTSECS typically +# report a serious problem and should be paused long enough to read +# whenever they appear (typically unexpectedly). The default values +# are defined in userdefs.h, and can be modified here should longer +# pauses be desired for braille-based access to Lynx. +# +# SVr4-curses implementations support time delays in milliseconds, +# hence the value may be given shorter, e.g., 0.5 +# +# Use the NO_PAUSE option (like the command-line -nopause) to override +# all of the delay times. +# +#INFOSECS:1 +#MESSAGESECS:2 +#ALERTSECS:3 +NO_PAUSE:TRUE + +.h2 DEBUGSECS +# Set DEBUGSECS to a nonzero value to slow down progress messages +# (see "-delay" option). +#DEBUGSECS:0 + +.h2 REPLAYSECS +# Set REPLAYSECS to a nonzero value to allow for slow replaying of +# command scripts (see "-cmd_script" option). +#REPLAYSECS:0 + +.h1 Appearance +# These settings control the appearance of Lynx's screen and the way +# Lynx renders some tags. + +.h2 USE_SELECT_POPUPS +# If USE_SELECT_POPUPS is set FALSE, Lynx will present a vertical list of +# radio buttons for the OPTIONs in SELECT blocks which lack the MULTIPLE +# attribute, instead of using a popup menu. Note that if the MULTIPLE +# attribute is present in the SELECT start tag, Lynx always will create a +# vertical list of checkboxes for the OPTIONs. +# The default defined here or in userdefs.h can be changed via the 'o'ptions +# menu and saved in the RC file, and always can be toggled via the -popup +# command line switch. +# +#USE_SELECT_POPUPS:TRUE + +.h2 SHOW_CURSOR +# SHOW_CURSOR controls whether or not the cursor is hidden or appears +# over the current link in documents or the current option in popups. +# Showing the cursor is handy if you are a sighted user with a poor +# terminal that can't do bold and reverse video at the same time or +# at all. It also can be useful to blind users, as an alternative +# or supplement to setting LINKS_AND_FIELDS_ARE_NUMBERED or +# LINKS_ARE_NUMBERED. +# The default defined here or in userdefs.h can be changed via the +# 'o'ptions menu and saved in the RC file, and always can be toggled +# via the -show_cursor command line switch. +# +SHOW_CURSOR:TRUE + +.h2 UNDERLINE_LINKS +# UNDERLINE_LINKS controls whether links are underlined by default, or shown +# in bold. Normally this default is set from the configure script. +# +#UNDERLINE_LINKS:FALSE + +.h2 BOLD_HEADERS +# If BOLD_HEADERS is set to TRUE the HT_BOLD default style will be acted +# upon for

through

headers. The compilation default is FALSE +# (only the indentation styles are acted upon, but see BOLD_H1, below). +# On Unix, compilation with -DUNDERLINE_LINKS also will apply to the +# HT_BOLD style for headers when BOLD_HEADERS is TRUE. +# +#BOLD_HEADERS:FALSE + +.h2 BOLD_H1 +# If BOLD_H1 is set to TRUE the HT_BOLD default style will be acted +# upon for

headers even if BOLD_HEADERS is FALSE. The compilation +# default is FALSE. On Unix, compilation with -DUNDERLINE_LINKS also +# will apply to the HT_BOLD style for headers when BOLD_H1 is TRUE. +# +#BOLD_H1:FALSE + +.h2 BOLD_NAME_ANCHORS +# If BOLD_NAME_ANCHORS is set to TRUE the content of anchors without +# an HREF attribute, (i.e., anchors with a NAME or ID attribute) will +# have the HT_BOLD default style. The compilation default is FALSE. +# On Unix, compilation with -DUNDERLINE_LINKS also will apply to the +# HT_BOLD style for NAME (ID) anchors when BOLD_NAME_ANCHORS is TRUE. +# +#BOLD_NAME_ANCHORS:FALSE + +.h1 Internal Behavior + +.h2 DEFAULT_CACHE_SIZE +.h2 DEFAULT_VIRTUAL_MEMORY_SIZE +# The DEFAULT_CACHE_SIZE specifies the number of WWW documents to be +# cached in memory at one time. +# +# This so-called cache size (actually, number) is defined in userdefs.h and +# may be modified here and/or with the command line argument -cache=NUMBER +# The minimum allowed value is 2, for the current document and at least one +# to fetch, and there is no absolute maximum number of cached documents. +# On Unix, and VMS not compiled with VAXC, whenever the number is exceeded +# the least recently displayed document will be removed from memory. +# +# On VMS compiled with VAXC, the DEFAULT_VIRTUAL_MEMORY_SIZE specifies the +# amount (bytes) of virtual memory that can be allocated and not yet be freed +# before previous documents are removed from memory. If the values for both +# the DEFAULT_CACHE_SIZE and DEFAULT_VIRTUAL_MEMORY_SIZE are exceeded, then +# the least recently displayed documents will be freed until one or the other +# value is no longer exceeded. The default value is defined in userdefs.h. +# +# The Unix and VMS (but not VAXC) implementations use the C library malloc's +# and calloc's for memory allocation, but procedures for taking the actual +# amount of cache into account still need to be developed. They use only +# the DEFAULT_CACHE_SIZE value, and that specifies the absolute maximum +# number of documents to cache (rather than the maximum number only if +# DEFAULT_VIRTUAL_MEMORY_SIZE has been exceeded, as with VAXC/VAX). +# +#DEFAULT_CACHE_SIZE:10 +#DEFAULT_VIRTUAL_MEMORY_SIZE:512000 + +.h2 SOURCE_CACHE +# SOURCE_CACHE sets the source caching behavior for Lynx: +# +# FILE causes Lynx to keep a temporary file for each cached document +# containing the HTML source of the document, which it uses to regenerate +# the document when certain settings are changed (for instance, +# historical vs. minimal vs. valid comment parsing) instead of reloading +# the source from the network. +# +# MEMORY is like FILE, except the document source is kept in memory. You +# may wish to adjust DEFAULT_CACHE_SIZE and DEFAULT_VIRTUAL_MEMORY_SIZE +# accordingly. +# +# NONE is the default; the document source is not cached, and is reloaded +# from the network when needed. +# +#SOURCE_CACHE:NONE + +.h2 SOURCE_CACHE_FOR_ABORTED +# This setting controls what will happen with cached source for the document +# being fetched from the net if fetching was aborted (either user pressed +# 'z' or network went down). If set to KEEP, the source fetched so far will +# be preserved (and used as cache), if set to DROP lynx will drop the +# source cache for that document (i.e. only completely downloaded documents +# will be cached in that case). +#SOURCE_CACHE_FOR_ABORTED:DROP + +.h2 ALWAYS_RESUBMIT_POSTS +# If ALWAYS_RESUBMIT_POSTS is set TRUE, Lynx always will resubmit forms +# with method POST, dumping any cache from a previous submission of the +# form, including when the document returned by that form is sought with +# the PREV_DOC command or via the history list. Lynx always resubmits +# forms with method POST when a submit button or a submitting text input +# is activated, but normally retrieves the previously returned document +# if it had links which you activated, and then go back with the PREV_DOC +# command or via the history list. +# +# The default defined here or in userdefs.h can be toggled via +# the -resubmit_forms command line switch. +# +#ALWAYS_RESUBMIT_POSTS:FALSE + +.h2 TRIM_INPUT_FIELDS +# If TRIM_INPUT_FIELDS is set TRUE, Lynx will trim trailing whitespace (e.g., +# space, tab, carriage return, line feed and form feed) from the text entered +# into form text and textarea fields. Older versions of Lynx do this trimming +# unconditionally, but other browsers do not, which would yield different +# behavior for CGI scripts. +#TRIM_INPUT_FIELDS:FALSE + +.h1 HTML Parsing + +.h2 NO_ISMAP_IF_USEMAP +# If NO_ISMAP_IF_USEMAP is set TRUE, Lynx will not include a link to the +# server-side image map if both a server-side and client-side map for the +# same image is indicated in the HTML markup. The compilation default is +# FALSE, such that a link with "[ISMAP]" as the link name, followed by a +# hyphen, will be prepended to the ALT string or "[USEMAP]" pseudo-ALT for +# accessing Lynx's text-based rendition of the client-side map (based on +# the content of the associated MAP element). If the "[ISMAP]" link is +# activated, Lynx will send a 0,0 coordinate pair to the server, which +# Lynx-friendly sites can map to a for-text-client document, homologous +# to what is intended for the content of a FIG element. +# +# The compilation default, or default defined here, can be toggled via +# the "-ismap" command line switch. +# +#NO_ISMAP_IF_USEMAP:FALSE + +.h2 SEEK_FRAG_MAP_IN_CUR +# If SEEK_FRAG_MAP_IN_CUR is set FALSE, then USEMAP attribute values +# (in IMG or OBJECT tags) consisting of only a fragment (USEMAP="#foo") +# will be resolved with respect to the current document's base, which +# might not be the same as the current document's URL. +# The compilation default is to use the current document's URL in all +# cases (i.e., assume the MAP is present below, if it wasn't present +# above the point in the HTML stream where the USEMAP attribute was +# detected). Lynx's present "single pass" rendering engine precludes +# checking below before making the decision on how to resolve a USEMAP +# reference consisting solely of a fragment. +# +#SEEK_FRAG_MAP_IN_CUR:TRUE + +.h2 SEEK_FRAG_AREA_IN_CUR +# If SEEK_FRAG_AREA_IN_CUR is set FALSE, then HREF attribute values +# in AREA tags consisting of only a fragment (HREF="#foo") will be +# resolved with respect to the current document's base, which might +# not be the same as the current document's URL. The compilation +# default is to use the current document's URL, as is done for the +# HREF attribute values of Anchors and LINKs that consist solely of +# a fragment. +# +#SEEK_FRAG_AREA_IN_CUR:TRUE + +.h1 CGI scripts +# These settings control Lynx's ability to execute various types of scripts. + +.h2 LOCAL_EXECUTION_LINKS_ALWAYS_ON +.h2 LOCAL_EXECUTION_LINKS_ON_BUT_NOT_REMOTE +# Local execution links and scripts are by default completely disabled, +# unless a change is made to the userdefs.h file to enable them or +# the configure script is used with the corresponding options +# (-enable-exec-links and -enable-exec-scripts). +# See the Lynx source code distribution and the userdefs.h +# file for more detail on enabling execution links and scripts. +# +# If you have enabled execution links or scripts the following +# two variables control Lynx's action when an execution link +# or script is encountered. +# +# If LOCAL_EXECUTION_LINKS_ALWAYS_ON is set to TRUE any execution +# link or script will be executed no matter where it came from. +# This is EXTREMELY dangerous. Since Lynx can access files from +# anywhere in the world, you may encounter links or scripts that +# will cause damage or compromise the security of your system. +# +# If LOCAL_EXECUTION_LINKS_ON_BUT_NOT_REMOTE is set to TRUE only +# links or scripts that reside on the local machine and are +# referenced with a URL beginning with "file://localhost/" or meet +# TRUSTED_EXEC or ALWAYS_TRUSTED_EXEC rules (see below) will be +# executed. This is much less dangerous than enabling all execution +# links, but can still be dangerous. +# +#LOCAL_EXECUTION_LINKS_ALWAYS_ON:FALSE +#LOCAL_EXECUTION_LINKS_ON_BUT_NOT_REMOTE:FALSE + +.h2 TRUSTED_EXEC +# If LOCAL_EXECUTION_LINK_ON_BUT_NOT_REMOTE is TRUE, and no TRUSTED_EXEC +# rule is defined, it defaults to "file://localhost/" and any lynxexec +# or lynxprog command will be permitted if it was referenced from within +# a document whose URL begins with that string. If you wish to restrict the +# referencing URLs further, you can extend the string to include a trusted +# path. You also can specify a trusted directory for http URLs, which will +# then be treated as if they were local rather than remote. For example: +# +# TRUSTED_EXEC:file://localhost/trusted/ +# TRUSTED_EXEC:http://www.wfbr.edu/trusted/ +# +# If you also wish to restrict the commands which can be executed, create +# a series of rules with the path (Unix) or command name (VMS) following +# the string, separated by a tab. For example: +# +# Unix: +# ==== +# TRUSTED_EXEC:file://localhost//bin/cp +# TRUSTED_EXEC:file://localhost//bin/rm +# VMS: +# === +# TRUSTED_EXEC:file://localhost/copy +# TRUSTED_EXEC:file://localhost/delete +# +# Once you specify a TRUSTED_EXEC referencing string, the default is +# replaced, and all the referencing strings you desire must be specified +# as a series. Similarly, if you associate a command with the referencing +# string, you must specify all of the allowable commands as a series of +# TRUSTED_EXEC rules for that string. If you specify ALWAYS_TRUSTED_EXEC +# rules below, you need not repeat them as TRUSTED_EXEC rules. +# +# If EXEC_LINKS and JUMPFILE have been defined, any lynxexec or lynxprog +# URLs in that file will be permitted, regardless of other settings. If +# you also set LOCAL_EXECUTION_LINKS_ON_BUT_NOT_REMOTE:TRUE and a single +# TRUSTED_EXEC rule that will always fail (e.g., "none"), then *ONLY* the +# lynxexec or lynxprog URLs in JUMPFILE (and any ALWAYS_TRUSTED_EXEC rules, +# see below) will be allowed. Note, however, that if Lynx was compiled with +# CAN_ANONYMOUS_JUMP set to FALSE (default is TRUE), or -restrictions=jump +# is included with the -anonymous switch at run time, then users of an +# anonymous account will not be able to access the jumps file or enter +# 'j'ump shortcuts, and this selective execution feature will be overridden +# as well (i.e., they will only be able to access lynxexec or lynxprog +# URLs which meet any ALWAYS_TRUSTED_EXEC rules). +# +TRUSTED_EXEC:none + +.h2 ALWAYS_TRUSTED_EXEC +# If EXEC_LINKS was defined, any lynxexec or lynxprog URL can be made +# always enabled by an ALWAYS_TRUSTED_EXEC rule for it. This is useful for +# anonymous accounts in which you have disabled execution links generally, +# and may also have disabled jumps file links, but still want to allow +# execution of particular utility scripts or programs. The format is +# like that for TRUSTED_EXEC. For example: +# +# Unix: +# ==== +# ALWAYS_TRUSTED_EXEC:file://localhost//usr/local/kinetic/bin/usertime +# ALWAYS_TRUSTED_EXEC:http://www.more.net//usr/local/kinetic/bin/who.sh +# VMS: +# === +# ALWAYS_TRUSTED_EXEC:file://localhost/usertime +# ALWAYS_TRUSTED_EXEC:http://www.more.net/show users +# +# The default ALWAYS_TRUSTED_EXEC rule is "none". +# +ALWAYS_TRUSTED_EXEC:none + +.h2 TRUSTED_LYNXCGI +# Unix: +# ===== +# TRUSTED_LYNXCGI rules define the permitted sources and/or paths for +# lynxcgi links (if LYNXCGI_LINKS is defined in userdefs.h). The format +# is the same as for TRUSTED_EXEC rules (see above). Example rules: +# +# TRUSTED_LYNXCGI:file://localhost/ +# TRUSTED_LYNXCGI:/usr/local/etc/httpd/cgi-bin/ +# TRUSTED_LYNXCGI:file://localhost//usr/local/www/cgi-bin/ +# +# VMS: +# ==== +# Do not define this. +# +# The default TRUSTED_LYNXCGI rule is "none". +# +#TRUSTED_LYNXCGI:none + +.h2 LYNXCGI_ENVIRONMENT +# Unix: +# ===== +# LYNXCGI_ENVIRONMENT adds the current value of the specified +# environment variable to the list of environment variables passed on to the +# lynxcgi script. Useful variables are HOME, USER, etc... If proxies +# are in use, and the script invokes another copy of lynx (or a program like +# wget) in a subsidiary role, it can be useful to add http_proxy and other +# *_proxy variables. +# +# VMS: +# ==== +# Do not define this. +# +#LYNXCGI_ENVIRONMENT: + +.h2 LYNXCGI_DOCUMENT_ROOT +# Unix: +# ===== +# LYNXCGI_DOCUMENT_ROOT is the value of DOCUMENT_ROOT that will be passed +# to lynxcgi scripts. If set and the URL has PATH_INFO data, then +# PATH_TRANSLATED will also be generated. Examples: +# LYNXCGI_DOCUMENT_ROOT:/usr/local/etc/httpd/htdocs +# LYNXCGI_DOCUMENT_ROOT:/data/htdocs/ +# +# VMS: +# ==== +# Do not define this. +# +#LYNXCGI_DOCUMENT_ROOT: + +.h1 Cookies + +.h2 FORCE_SSL_COOKIES_SECURE +# If FORCE_SSL_COOKIES_SECURE is set to TRUE, then SSL encrypted cookies +# received from https servers never will be sent unencrypted to http +# servers. The compilation default is to impose this block only if the +# https server included a secure attribute for the cookie. The normal +# default or that defined here can be toggled via the -force_secure +# command line switch. +# +#FORCE_SSL_COOKIES_SECURE:FALSE + +.h1 Internal Behavior + +.h2 MAIL_SYSTEM_ERROR_LOGGING +# MAIL_SYSTEM_ERROR_LOGGING will send a message to the owner of +# the information, or ALERTMAIL if there is no owner, every time +# that a document cannot be accessed! +# +# NOTE: This can generate A LOT of mail, be warned. +# +#MAIL_SYSTEM_ERROR_LOGGING:FALSE + +.h2 CHECKMAIL +# If CHECKMAIL is set to TRUE, the user will be informed (via a statusline +# message) about the existence of any unread mail at startup of Lynx, and +# will get statusline messages if subsequent new mail arrives. If a jumps +# file with a lynxprog URL for invoking mail is available, or your html +# pages include an mail launch file URL, the user thereby can access mail +# and read the messages. The checks and statusline reports will not be +# performed if Lynx has been invoked with the -restrictions=mail switch. +# +# VMS USERS !!! +# ============= +# New mail is normally broadcast as it arrives, via "unsolicited screen +# broadcasts", which can be "wiped" from the Lynx display via the Ctrl-W +# command. You may prefer to disable the broadcasts and use CHECKMAIL +# instead (e.g., in a public account which will be used by people who +# are ignorant about VMS). +# +#CHECKMAIL:FALSE + +.h1 News-groups + +.h2 NNTPSERVER +# To enable news reading ability via Lynx, the environment variable NNTPSERVER +# must be set so that it points to your site's NNTP server +# (see Lynx Users Guide on environment variables). +# Lynx respects RFC 1738 +.url http://tools.ietf.org/html/rfc1738 +# and does not accept a host field in news URLs (use nntp: instead of news: for +# the scheme if you wish to specify an NNTP host in a URL, as explained in the +# RFC). If you have not set the variable externally, you can set it at run +# time via this configuration file. It will not override an external setting. +# Note that on VMS it is set as a process logical rather than symbol, and will +# outlive the Lynx image. +# The news reading facility in Lynx is quite limited. Lynx does not provide a +# full featured news reader with elaborate error checking and safety features. +# +#NNTPSERVER:news.server.dom + +.h2 LIST_NEWS_NUMBERS +# If LIST_NEWS_NUMBERS is set TRUE, Lynx will use an ordered list and include +# the numbers of articles in news listings, instead of using an unordered +# list. The default is defined in userdefs.h, and can be overridden here. +# +#LIST_NEWS_NUMBERS:FALSE + +.h2 LIST_NEWS_DATES +# If LIST_NEWS_DATES is set TRUE, Lynx will include the dates of articles in +# news listings. The dates always are included in the articles, themselves. +# The default is defined in userdefs.h, and can be overridden here. +# +#LIST_NEWS_DATES:FALSE + +.h2 NEWS_CHUNK_SIZE +.h2 NEWS_MAX_CHUNK +# NEWS_CHUNK_SIZE and NEWS_MAX_CHUNK regulate the chunking of news article +# listings with inclusion of links for listing earlier and/or later articles. +# The defaults are defined in HTNews.c as 30 and 40, respectively. If the +# news group contains more than NEWS_MAX_CHUNK articles, they will be listed +# in NEWS_CHUNK_SIZE chunks. You can change the defaults here, and/or on +# the command line via -newschunksize=NUMBER and/or -newsmaxchunk=NUMBER +# switches. Note that if the chunk size is increased, here or on the command +# line, to a value greater than the current maximum, the maximum will be +# increased to that number. Conversely, if the maximum is set to a number +# less than the current chunk size, the chunk size will be reduced to that +# number. Thus, you need use only one of the two switches on the command +# line, based on the direction of intended change relative to the compilation +# or configuration defaults. The compilation defaults ensure that there will +# be at least 10 earlier articles before bothering to chunk and create a link +# for earlier articles. +# +#NEWS_CHUNK_SIZE:30 +#NEWS_MAX_CHUNK:40 + +.h2 NEWS_POSTING +# Set NEWS_POSTING to FALSE if you do not want to support posting to +# news groups via Lynx. If left TRUE, Lynx will use its news gateway to +# post new messages or followups to news groups, using the URL schemes +# described in the "Supported URLs" section of the online 'h'elp. The +# posts will be attempted via the nntp server specified in the URL, or +# if none was specified, via the NNTPSERVER configuration or environment +# variable. Links with these URLs for posting or sending followups are +# created by the news gateway when reading group listings or articles +# from nntp servers if the server indicates that it permits posting. +# The compilation default set in userdefs.h can be changed here. If +# the default is TRUE, posting can still be disallowed via the +# -restrictions command line switch. +# The posting facility in Lynx is quite limited. Lynx does not provide a +# full featured news poster with elaborate error checking and safety features. +# +#NEWS_POSTING:TRUE + +.h2 LYNX_SIG_FILE +# LYNX_SIG_FILE defines the name of a file containing a signature which +# can be appended to email messages and news postings or followups. The +# user will be prompted whether to append it. It is sought in the home +# directory. If it is in a subdirectory, begin it with a dot-slash +# (e.g., ./lynx/.lynxsig). The definition is set in userdefs.h and can +# be changed here. +# +#LYNX_SIG_FILE:.lynxsig + +.h1 Bibliographic Protocol (bibp scheme) + +.h2 BIBP_GLOBAL_SERVER +# BIBP_GLOBAL_SERVER is the default global server for bibp: links, used +# when a local bibhost or document-specified citehost is unavailable. +# Set in userdefs.h and can be changed here. +#BIBP_GLOBAL_SERVER:http://usin.org/ + +.h2 BIBP_BIBHOST +# BIBP_BIBHOST is the URL at which local bibp service may be found, if +# it exists. Defaults to http://bibhost/ for protocol conformance, but +# may be overridden here or via -bibhost parameter. +#BIBP_BIBHOST:http://bibhost/ + +.h1 Interaction +# These settings control interaction of the user with lynx. + +.h2 SCROLLBAR +# If SCROLLBAR is set TRUE, Lynx will show scrollbar on windows. With mouse +# enabled, the scrollbar strip outside the bar is clickable, and scrolls the +# window by pages. The appearance of the scrollbar can be changed from +# LYNX_LSS file: define attributes scroll.bar, scroll.back (for the bar, and +# for the strip along which the scrollbar moves). +#SCROLLBAR:FALSE + +.h2 SCROLLBAR_ARROW +# If SCROLLBAR_ARROW is set TRUE, Lynx's scrollbar will have arrows at the +# ends. With mouse enabled, the arrows are clickable, and scroll the window by +# 2 lines. The appearance of the scrollbar arrows can be changed from LYNX_LSS +# file: define attributes scroll.arrow, scroll.noarrow (for enabled-arrows, +# and disabled arrows). An arrow is "disabled" if the bar is at this end of +# the strip. +#SCROLLBAR_ARROW:TRUE + +.h2 USE_MOUSE +# If Lynx is configured with ncurses, PDcurses or slang & USE_MOUSE is TRUE, +# users can perform commands by left-clicking certain parts of the screen: +# on a link = `g'oto + ACTIVATE (i.e., move highlight & follow the link); +# on the top/bottom lines = PREV/NEXT_PAGE (i.e., go up/down 1 page); +# on the top/bottom left corners = PREV/NEXT_DOC (i.e., go to the previous +# document / undo goto previous document); +# on the top/bottom right corners = HISTORY/VLINKS (i.e., call up the history +# page or visited links page if on history page). +# NB if the mouse is defined in this way, it will not be available +# for copy/paste operations using the clipboard of a desktop manager: +# for flexibility instead, use the command-line switch -use_mouse . +# +# ncurses and slang have built-in support for the xterm mouse protocol. In +# addition, ncurses can be linked with the gpm mouse library, to automatically +# provide support for this interface in applications such as Lynx. (Please +# read the ncurses faq to work around broken gpm configurations packaged by +# some distributors). PDCurses implements mouse support for win32 console +# windows, as does slang. +#USE_MOUSE:FALSE + +.h1 HTML Parsing +# These settings control the way Lynx parses invalid HTML +# and how it may resolve such issues. + +.h2 COLLAPSE_BR_TAGS +# If COLLAPSE_BR_TAGS is set FALSE, Lynx will not collapse serial BR tags. +# If set TRUE, two or more concurrent BRs will be collapsed into a single +# line break. Note that the valid way to insert extra blank lines in HTML +# is via a PRE block with only newlines in the block. +# +#COLLAPSE_BR_TAGS:TRUE + +.h2 TRIM_BLANK_LINES +# If TRIM_BLANK_LINES is set FALSE, Lynx will not trim trailing blank lines +# from the document. Also, Lynx will not collapse BR-tags onto the previous +# line when it happens to be empty. +#TRIM_BLANK_LINES:TRUE + +.h2 TAGSOUP +# If TAGSOUP is set, Lynx uses the "Tag Soup DTD" rather than "SortaSGML". +# The two approaches differ by the style of error detection and recovery. +# Tag Soup DTD allows for improperly nested tags; SortaSGML is stricter. +#TAGSOUP:FALSE + +.h1 Cookies + +.h2 SET_COOKIES +# If SET_COOKIES is set FALSE, Lynx will ignore Set-Cookie headers +# in http server replies. Note that if a COOKIE_FILE is in use (see +# below) that contains cookies at startup, Lynx will still send those +# persistent cookies in requests as appropriate. Setting SET_COOKIES +# to FALSE just prevents accepting any new cookies from servers. To +# prevent all cookie processing (sending *and* receiving) in a session, +# make sure that PERSISTENT_COOKIES is not TRUE or that COOKIE_FILE does +# not point to a file with cookies, in addition to setting SET_COOKIES +# to FALSE. +# The default is defined in userdefs.h, and can be overridden here, +# and/or toggled via the -cookies command line switch. +# +SET_COOKIES:FALSE + +.h2 ACCEPT_ALL_COOKIES +# If ACCEPT_ALL_COOKIES is set TRUE, Lynx will accept cookies from all +# domains with no user interaction. This is equivalent to automatically +# replying to all cookie 'Allow?' prompts with 'A'lways. Note that it +# does not preempt validity checking, which has to be controlled separately +# (see below). +# The default is defined in userdefs.h and can be overridden here, or +# in the .lynxrc file via an o(ptions) screen setting. It may also be +# toggled via the -accept_all_cookies command line switch. +# +ACCEPT_ALL_COOKIES:FALSE + +.h2 COOKIE_ACCEPT_DOMAINS +.h2 COOKIE_REJECT_DOMAINS +# COOKIE_ACCEPT_DOMAINS and COOKIE_REJECT_DOMAINS are comma-delimited lists +# of domains from which Lynx should automatically accept or reject cookies +# without asking for confirmation. If the same domain is specified in both +# lists, rejection will take precedence. +# Note that in order to match cookies, domains have to be spelled out exactly +# in the form in which they would appear on the Cookie Jar page (case is +# insignificant). They are not wildcards. Domains that apply to more than +# one host have a leading '.', but have to match *the cookie's* domain +# exactly. +# +#COOKIE_ACCEPT_DOMAINS: +#COOKIE_REJECT_DOMAINS: + +.h2 COOKIE_LOOSE_INVALID_DOMAINS +.h2 COOKIE_STRICT_INVALID_DOMAINS +.h2 COOKIE_QUERY_INVALID_DOMAINS +# COOKIE_LOOSE_INVALID_DOMAINS, COOKIE_STRICT_INVALID_DOMAINS, and +# COOKIE_QUERY_INVALID_DOMAINS are comma-delimited lists of domains. +# They control the degree of validity checking that is applied to cookies +# for the specified domains. +# Note that in order to match cookies, domains have to be spelled out exactly +# in the form in which they would appear on the Cookie Jar page (case is +# insignificant). They are not wildcards. Domains that apply to more than +# one host have a leading '.', but have to match *the cookie's* domain +# exactly. +# If a domain is set to strict checking, strict conformance to RFC 2109 will +# be applied. A domain with loose checking will be allowed to set cookies +# with an invalid path or domain attribute. All domains will default to +# asking the user for confirmation in case of an invalid path or domain. +# Cookie validity checking takes place as a separate step before the +# final decision to accept or reject (see previous options), therefore +# a cookie that passes validity checking may still be automatically +# rejected or cause another prompt. +# +#COOKIE_LOOSE_INVALID_DOMAINS: +#COOKIE_STRICT_INVALID_DOMAINS: +#COOKIE_QUERY_INVALID_DOMAINS: + +.h2 MAX_COOKIES_DOMAIN +.h2 MAX_COOKIES_GLOBAL +.h2 MAX_COOKIES_BUFFER +# MAX_COOKIES_DOMAIN, +# MAX_COOKIES_GLOBAL and +# MAX_COOKIES_BUFFER are limits on the total number of cookies for each domain, +# globally, and the per-cookie buffer size. These limits are by default large +# enough for reasonable usage; if they are very high, some sites may present +# undue performance waste. +# +#MAX_COOKIES_DOMAIN:50 +#MAX_COOKIES_GLOBAL:500 +#MAX_COOKIES_BUFFER:4096 + +.h2 PERSISTENT_COOKIES +# PERSISTENT_COOKIES indicates that cookies should be read at startup from +# the COOKIE_FILE, and saved at exit for storage between Lynx sessions. +# It is not used if Lynx was compiled without USE_PERSISTENT_COOKIES. +# The default is FALSE, so that the feature needs to be enabled here +# explicitly if you want it. +# +PERSISTENT_COOKIES:FALSE + +.h2 COOKIE_FILE +# COOKIE_FILE is the default file from which persistent cookies are read +# at startup (if the file exists), if Lynx was compiled with +# USE_PERSISTENT_COOKIES and the PERSISTENT_COOKIES option is enabled. +# The cookie file can also be specified in .lynxrc or on the command line. +# +#COOKIE_FILE:~/.lynx_cookies + +.h2 COOKIE_SAVE_FILE +# COOKIE_SAVE_FILE is the default file in which persistent cookies are +# stored at exit, if Lynx was compiled with USE_PERSISTENT_COOKIES and the +# PERSISTENT_COOKIES option is enabled. The cookie save file can also be +# specified on the command line. +# +# With an interactive Lynx session, COOKIE_SAVE_FILE will default to +# COOKIE_FILE if it is not set. With a non-interactive Lynx session (e.g., +# -dump), cookies will only be saved to file if COOKIE_SAVE_FILE is set. +# +#COOKIE_SAVE_FILE:~/.lynx_cookies + +.h1 Mail-related + +.h2 SYSTEM_MAIL +.h2 SYSTEM_MAIL_FLAGS +# VMS: +# === +# The mail command and qualifiers are defined in userdefs.h. Lynx +# will spawn a subprocess to send replies and error messages. The +# command, and qualifiers (if any), can be re-defined here. If +# you use PMDF then headers will we passed via a header file. +# If you use "generic" VMS MAIL, the subject will be passed on the +# command line via a /subject="SUBJECT" qualifier, and inclusion +# of other relevant headers may not be possible. +# If your mailer uses another syntax, some hacking of the mailform() +# mailmsg() and reply_by_mail() functions in LYMail.c, and send_file_to_mail() +# function in LYPrint.c, may be required. +# +.ex 2 +#SYSTEM_MAIL:PMDF SEND +#SYSTEM_MAIL_FLAGS:/headers +# +.ex 2 +#SYSTEM_MAIL:MAIL +#SYSTEM_MAIL_FLAGS: +# +# Unix: +#====== +# The mail path and flags normally are defined for sendmail (or submit +# with MMDF) in userdefs.h. You can change them here, but should first +# read the zillions of CERT advisories about security problems with Unix +# mailers. +# +.ex 2 +#SYSTEM_MAIL:/usr/mmdf/bin/submit +#SYSTEM_MAIL_FLAGS:-mlruxto,cc\* +# +.ex 2 +#SYSTEM_MAIL:/usr/sbin/sendmail +#SYSTEM_MAIL_FLAGS:-t -oi +# +.ex 2 +#SYSTEM_MAIL:/usr/lib/sendmail +#SYSTEM_MAIL_FLAGS:-t -oi +# +# Win32: +#======= +# The Win32 port assumes that the mailer cannot read via a pipe. That is, it +# must read all information from files. The "sendmail" utility in the 2.8.1 +# release is able to work with that assumption. There is no way to tell the +# Win32 port of Lynx to send its information to the sendmail utility via a +# pipe. +# +# Please read sendmail.txt in the LYNX_W32.ZIP distribution +.url http://invisible-mirror.net/archives/lynx/tarballs/lynx2.8.1_w32.zip +.url ftp://ftp.invisible-island.net/lynx/tarballs/lynx2.8.1_w32.zip +# +# As an alternative, the newer "sendmail for windows" may be useful: +.url http://glob.com.au/sendmail/ +# +# See also BLAT_MAIL and ALT_BLAT_MAIL flags. +# +#SYSTEM_MAIL:sendmail -f me@my.host -h my.host -r my.smtp.mailer -m SMTP + +.h2 MAIL_ADRS +# VMS ONLY: +# ======== +# MAIL_ADRS is defined in userdefs.h and normally is structured for PMDF's +# IN%"INTERNET_ADDRESS" scheme. The %s is replaced with the address given +# by the user. If you are using a different Internet mail transport, change +# the IN appropriately (e.g., to SMTP, MX, or WINS). +# +#MAIL_ADRS:"IN%%""%s""" + +.h2 USE_FIXED_RECORDS +# VMS ONLY: +# ======== +# If USE_FIXED_RECORDS is set to TRUE here or in userdefs.h, Lynx will +# convert 'd'ownloaded binary files to FIXED 512 record format before saving +# them to disk or acting on a DOWNLOADER option. If set to FALSE, the +# headers of such files will indicate that they are Stream_LF with Implied +# Carriage Control, which is incorrect, and can cause downloading software +# to get confused and unhappy. If you do set it FALSE, you can use the +# FIXED512.COM command file, which is included in this distribution, to do +# the conversion externally. +# +#USE_FIXED_RECORDS:TRUE + +.h1 Keyboard Input +# These settings control the way Lynx interprets user input. + +.h2 VI_KEYS_ALWAYS_ON +.h2 EMACS_KEYS_ALWAYS_ON +# Vi or Emacs movement keys, i.e. familiar hjkl or ^N^P^F^B . +# These are defaults, which can be changed in the Options Menu or .lynxrc . +VI_KEYS_ALWAYS_ON:TRUE +#EMACS_KEYS_ALWAYS_ON:FALSE + +.h2 DEFAULT_KEYPAD_MODE +# DEFAULT_KEYPAD_MODE may be set to NUMBERS_AS_ARROWS +# or LINKS_ARE_NOT_NUMBERED (the same) +# or LINKS_ARE_NUMBERED +# or LINKS_AND_FIELDS_ARE_NUMBERED +# or FIELDS_ARE_NUMBERED +# to specify whether numbers (e.g. [10]) appear next to all links, +# allowing immediate access by entering the number on the keyboard, +# or numbers on the numeric key-pad work like arrows; +# the "FIELDS" options cause form fields also to be numbered. +# This may be overridden by the keypad_mode setting in .lynxrc, +# and can also be changed via the Options Menu. +# +#DEFAULT_KEYPAD_MODE:NUMBERS_AS_ARROWS + +.h2 NUMBER_LINKS_ON_LEFT +.h2 NUMBER_FIELDS_ON_LEFT +# Denotes the position for link- and field-numbers (whether it is on the left +# or right of the anchor). These are subject to DEFAULT_KEYPAD_MODE, which +# determines whether numbers are shown. +#NUMBER_LINKS_ON_LEFT:TRUE +#NUMBER_FIELDS_ON_LEFT:TRUE + +.h2 DEFAULT_KEYPAD_MODE_IS_NUMBERS_AS_ARROWS +# Obsolete form of DEFAULT_KEYPAD_MODE, +# numbers work like arrows or numbered links. +# Set to TRUE, indicates numbers act as arrows, +# and set to FALSE indicates numbers refer to numbered links on the page. +# LINKS_AND_FIELDS_ARE_NUMBERED cannot be set by this option because +# it allows only two values (true and false). +# +#DEFAULT_KEYPAD_MODE_IS_NUMBERS_AS_ARROWS:TRUE + +.h2 CASE_SENSITIVE_ALWAYS_ON +# The default search type. +# This is a default that can be overridden by the user! +# +#CASE_SENSITIVE_ALWAYS_ON:FALSE + +.h1 Auxiliary Facilities + +.h2 DEFAULT_BOOKMARK_FILE +# DEFAULT_BOOKMARK_FILE is the filename used for storing personal bookmarks. +# It will be prepended by the user's home directory. +# NOTE that a file ending in .html or other suffix mapped to text/html +# should be used to ensure its treatment as HTML. The built-in default +# is lynx_bookmarks.html. On both Unix and VMS, if a subdirectory off of +# the HOME directory is desired, the path should begin with "./" (e.g., +# ./BM/lynx_bookmarks.html), but the subdirectory must already exist. +# Lynx will create the bookmark file, if it does not already exist, on +# the first ADD_BOOKMARK attempt if the HOME directory is indicated +# (i.e., if the definition is just filename.html without any slashes), +# but requires a pre-existing subdirectory to create the file there. +# The user can re-define the default bookmark file, as well as a set +# of sub-bookmark files if multiple bookmark file support is enabled +# (see below), via the 'o'ptions menu, and can save those definitions +# in the .lynxrc file. +# +DEFAULT_BOOKMARK_FILE:.lynx_bookmarks.html + +.h2 MULTI_BOOKMARK_SUPPORT +# If MULTI_BOOKMARK_SUPPORT is set TRUE, and BLOCK_MULTI_BOOKMARKS (see +# below) is FALSE, and sub-bookmarks exist, all bookmark operations will +# first prompt the user to select an active sub-bookmark file or the +# default bookmark file. FALSE is the default so that one (the default) +# bookmark file will be available initially. The definition here will +# override that in userdefs.h. The user can turn on multiple bookmark +# support via the 'o'ptions menu, and can save that choice as the startup +# default via the .lynxrc file. When on, the setting can be STANDARD or +# ADVANCED. If SUPPORT is set to the latter, and the user mode also is +# ADVANCED, the VIEW_BOOKMARK command will invoke a statusline prompt at +# which the user can enter the letter token (A - Z) of the desired bookmark, +# or '=' to get a menu of available bookmark files. The menu always is +# presented in NOVICE or INTERMEDIATE mode, or if the SUPPORT is set to +# STANDARD. No prompting or menu display occurs if only one (the startup +# default) bookmark file has been defined (define additional ones via the +# 'o'ptions menu). The startup default, however set, can be overridden on +# the command line via the -restrictions=multibook or the -anonymous or +# -validate switches. +# +#MULTI_BOOKMARK_SUPPORT:FALSE + +.h2 BLOCK_MULTI_BOOKMARKS +# If BLOCK_MULTI_BOOKMARKS is set TRUE, multiple bookmark support will +# be forced off, and cannot to toggled on via the 'o'ptions menu. The +# compilation setting is normally FALSE, and can be overridden here. +# It can also be set via the -restrictions=multibook or the -anonymous +# or -validate command line switches. +# +#BLOCK_MULTI_BOOKMARKS:FALSE + +.h1 Interaction + +.h2 DEFAULT_USER_MODE +# DEFAULT_USER_MODE sets the default user mode for Lynx users. +# NOVICE shows a three line help message at the bottom of the screen. +# INTERMEDIATE shows normal amount of help (one line). +# ADVANCED help is replaced by the URL of the current link. +# +DEFAULT_USER_MODE:ADVANCED + +.h1 External Programs + +.h2 DEFAULT_EDITOR +# If DEFAULT_EDITOR is defined, users may edit local documents with it +# & it will also be used for sending mail messages. +# If no editor is defined here or by the user, +# the user will not be able to edit local documents +# and a primitive line-oriented mail-input mode will be used. +# +# For sysadmins: do not define a default editor +# unless you know EVERY user will know how to use it; +# users can easily define their own editor in the Options Menu. +# +#DEFAULT_EDITOR: + +.h2 SYSTEM_EDITOR +# SYSTEM_EDITOR behaves the same as DEFAULT_EDITOR, +# except that it can't be changed by users. +# +#SYSTEM_EDITOR: + +.h3 POSITIONABLE_EDITOR +# If POSITIONABLE_EDITOR is defined once or multiple times and if the same +# editor is used as editor in lynx, lynx will use its features, i.e., adding an +# option to set the initial line-position, when editing files and textarea. +# The commented editors below are already known; there is no need to uncomment +# them. +# +#POSITIONABLE_EDITOR:emacs +#POSITIONABLE_EDITOR:jed +#POSITIONABLE_EDITOR:jmacs +#POSITIONABLE_EDITOR:joe +#POSITIONABLE_EDITOR:jove +#POSITIONABLE_EDITOR:jpico +#POSITIONABLE_EDITOR:jstar +#POSITIONABLE_EDITOR:nano +#POSITIONABLE_EDITOR:pico +#POSITIONABLE_EDITOR:rjoe +#POSITIONABLE_EDITOR:vi + +.h1 Proxy + +.h2 HTTP_PROXY +.h2 HTTPS_PROXY +.h2 FTP_PROXY +.h2 GOPHER_PROXY +.h2 NEWSPOST_PROXY +.h2 NEWSREPLY_PROXY +.h2 NEWS_PROXY +.h2 NNTP_PROXY +.h2 SNEWSPOST_PROXY +.h2 SNEWSREPLY_PROXY +.h2 SNEWS_PROXY +.h2 WAIS_PROXY +.h2 FINGER_PROXY +.h2 CSO_PROXY +# Lynx version 2.2 and beyond supports the use of proxy servers that can act as +# firewall gateways and caching servers. They are preferable to the older +# gateway servers. Each protocol used by Lynx can be mapped separately using +# PROTOCOL_proxy environment variables (see Lynx Users Guide). If you have not set +# them externally, you can set them at run time via this configuration file. +# They will not override external settings. The no_proxy variable can be used +# to inhibit proxying to selected regions of the Web (see below). Note that on +# VMS these proxy variables are set as process logicals rather than symbols, to +# preserve lowercasing, and will outlive the Lynx image. +# +.ex 15 +#http_proxy:http://some.server.dom:port/ +#https_proxy:http://some.server.dom:port/ +#ftp_proxy:http://some.server.dom:port/ +#gopher_proxy:http://some.server.dom:port/ +#news_proxy:http://some.server.dom:port/ +#newspost_proxy:http://some.server.dom:port/ +#newsreply_proxy:http://some.server.dom:port/ +#snews_proxy:http://some.server.dom:port/ +#snewspost_proxy:http://some.server.dom:port/ +#snewsreply_proxy:http://some.server.dom:port/ +#nntp_proxy:http://some.server.dom:port/ +#wais_proxy:http://some.server.dom:port/ +#finger_proxy:http://some.server.dom:port/ +#cso_proxy:http://some.server.dom:port/ +#no_proxy:host.domain.dom + +.h2 NO_PROXY +# The no_proxy variable can be a comma-separated list of strings defining +# no-proxy zones in the DNS domain name space. If a tail substring of the +# domain-path for a host matches one of these strings, transactions with that +# node will not be proxied. +.ex +#no_proxy:domain.path1,path2 +# +# A single asterisk as an entry will override all proxy variables and no +# transactions will be proxied. +.ex +#no_proxy:* +# This is the only allowed use of * in no_proxy. +# +# Warning: Note that setting 'il' as an entry in this list will block proxying +# for the .mil domain as well as the .il domain. If the entry is '.il' this +# will not happen. + +.h1 External Programs + +.h2 PRINTER +.h2 DOWNLOADER +.h2 UPLOADER +# PRINTER, DOWNLOADER & UPLOADER DEFINITIONS: +# Lynx has 4 pre-defined print options & 1 pre-defined download option, +# which are called up on-screen when `p' or `d' are entered; +# any number of options can be added by the user, as explained below. +# Uploaders can be defined only for UNIX with DIRED_SUPPORT: +# see the Makefile in the top directory & the header of src/LYUpload.c . +# +# For `p' pre-defined options are: `Save to local file', `E-mail the file', +# `Print to screen' and `Print to local printer attached to vt100'. +# `Print to screen' allows file transfers in the absence of alternatives +# and is often the only option allowed here for anonymous users; +# the 3rd & 4th options are not pre-defined for DOS/WINDOWS versions of Lynx. +# For `d' the pre-defined option is: `Download to local file'. +# +# To define your own print or download option use the following formats: +# +# PRINTER:::