summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.config/zsh/completion.zsh17
-rw-r--r--.config/zsh/completion/_lxc974
-rw-r--r--.config/zsh/completion/_lxd47
-rw-r--r--.zfunc/_fnm357
-rw-r--r--.zfunc/_pip318
5 files changed, 1 insertions, 1712 deletions
diff --git a/.config/zsh/completion.zsh b/.config/zsh/completion.zsh
index ed57020..9661ecc 100644
--- a/.config/zsh/completion.zsh
+++ b/.config/zsh/completion.zsh
@@ -60,7 +60,7 @@ zstyle ':completion:*:cd:*' ignore-parents parent pwd
setopt auto_cd
### Complete from middle of filename
-zstyle ':completion:*' matcher-list '' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' '+l:|=* r:|=*'
+setopt complete_in_word
### auto rehash
zstyle ':completion:*' rehash true
@@ -70,19 +70,4 @@ zstyle ':completion:*' menu select list-colors ${(s.:.)LS_COLORS}
### completion and prompt init
autoload -Uz compinit colors vcs_info
-fpath+=(~/.zfunc $fpath)
-fpath+=(~/.config/zsh/completion $fpath)
compinit
-__pip() {{
- compadd $( COMP_WORDS="$words[*]" \
- COMP_CWORD=$((CURRENT-1)) \
- PIP_AUTO_COMPLETE=1 $words[1] 2>/dev/null )
- }}
-if [[ $zsh_eval_context[-1] == loadautofunc ]]; then
- # autoload from fpath, call function directly
- __pip "$@"
-else
- # eval/source/. command, register function for later
- compdef __pip -P pip
- compdef __pip -P pip3
-fi
diff --git a/.config/zsh/completion/_lxc b/.config/zsh/completion/_lxc
deleted file mode 100644
index d2a6ccb..0000000
--- a/.config/zsh/completion/_lxc
+++ /dev/null
@@ -1,974 +0,0 @@
-#compdef lxc
-
-# _lxc
-#
-# Copyright (c) 2017 endaaman
-#
-# This software may be modified and distributed under the terms
-# of the MIT license. See the LICENSE file for details.
-
-_lxc() {
- local context curcontext=$curcontext state line
- local selected_container
- declare -A opt_args
-
- local opt_container_control=(
- '--all[Run command against all containers]' \
- '--stateful[Store the container state (only for stop)]' \
- '--stateless[Ignore the container state (only for start)]' \
- )
-
- _arguments -C \
- '--all[Print less common commands]' \
- '--version[Show client version]' \
- '1: :__lxc_commands' \
- '*:: :->args'
- case $state in
- (args)
- case $words[1] in
- (alias)
- case $words[2] in
- (remove|rename)
- _arguments -C \
- '2:containers:__lxc_aliases'
- ;;
- esac
- _arguments -C \
- '1: :__lxc_alias_commands'
- ;;
- (cluster)
- _arguments -C \
- '1: :__lxc_cluster_commands'
- ;;
- (config)
- case $words[2] in
- (get)
- _arguments -C \
- '2:containers:__lxc_containers_all'
- ;;
- (set)
- _arguments -C \
- '2:containers:__lxc_containers_all'
- ;;
- (unset)
- _arguments -C \
- '2:containers:__lxc_containers_all'
- ;;
- (show)
- _arguments -C \
- '2:containers:__lxc_containers_all'
- ;;
- (edit)
- _arguments -C \
- '2:containers:__lxc_containers_all'
- ;;
- (metadata)
- case $words[3] in
- (show)
- _arguments -C \
- '3:containers:__lxc_containers_all'
- ;;
- (edit)
- _arguments -C \
- '3:containers:__lxc_containers_all'
- ;;
- esac
- _arguments -C \
- '2: :__lxc_config_metadata_commands'
- ;;
- (template)
- case $words[3] in
- (list)
- _arguments -C \
- '3:containers:__lxc_containers_all'
- ;;
- (show|edit|delete)
- if [ $#words[@] -gt 4 ]; then
- _arguments -C \
- "*:Templates:($(__get_lxc_templates_by_container $words[4]))"
- fi
- _arguments -C \
- '3:containers:__lxc_containers_all'
- ;;
- (create)
- _arguments -C \
- '3:containers:__lxc_containers_all'
- ;;
- esac
- _arguments -C \
- '2: :__lxc_config_template_commands'
- ;;
- (device)
- case $words[3] in
- (add)
- # lxc config device add <container> <name> <type> <key1>=<value1>
- # 3 4 5 6
- if [ $#words[@] -gt 6 ]; then
- _arguments -C \
- "*:key-values:_sep_parts '$(__get_lxc_keys_by_device $words[6])' = '($(ls))'"
- fi
- _arguments -C \
- '3:containers:__lxc_containers_all' \
- '4: :_files' \
- '5:device type:__lxc_device_types'
- ;;
- (get|unset)
- if [ $#words[@] -eq 6 ]; then
- local type=$(lxc config device get $words[4] $words[5] type)
- _arguments -C "*:key-values:($(__get_lxc_keys_by_device $type))"
- fi
- selected_container=$words[4]
- _arguments -C \
- '3:containers:__lxc_containers_all' \
- '4:devices:__lxc_devices_by_container' \
- ;;
- # lxc config device set <container> <name> <key1>=<value1>
- # 3 4 5 6
- (set)
- if [ $#words[@] -eq 6 ]; then
- local type=$(lxc config device get $words[4] $words[5] type)
- _arguments -C \
- "*:key-values:_sep_parts '$(__get_lxc_keys_by_device $type)' = ($(ls))" \
- '7:files:_files'
- fi
- selected_container=$words[4]
- _arguments -C \
- '3:containers:__lxc_containers_all' \
- '4:devices:__lxc_devices_by_container' \
- ;;
- (override)
- if [ $#words[@] -gt 5 ]; then
- local type=$(lxc config device get $words[4] $words[5] type)
- _arguments -C \
- "*:key-values:_sep_parts '$(__get_lxc_keys_by_device $type)' ="
- fi
- selected_container=$words[4]
- _arguments -C \
- '3:containers:__lxc_containers_all' \
- '4:devices:__lxc_devices_by_container' \
- ;;
- (show|list)
- _arguments -C \
- '3:containers:__lxc_containers_all' \
- ;;
- (remove)
- selected_container=$words[4]
- _arguments -C \
- '3:containers:__lxc_containers_all' \
- '4:devices:__lxc_devices_by_container' \
- ;;
- esac
- _arguments -C \
- '2: :__lxc_config_device_commands'
- ;;
- (trust)
- _arguments -C \
- '2: :__lxc_config_trust_commands'
- case $words[3] in
- (list|add|remove)
- # complete remote
- ;;
- esac
- ;;
- esac
- _arguments -C \
- '1: :__lxc_config_commands' \
- '--expanded[Show the expanded configuration]'
- ;;
- (console)
- _arguments -C \
- '1:containers:__lxc_containers_running'
- ;;
- (copy)
- _arguments -C \
- {-c,--config}'[Config key/value to apply to the new instance]' \
- {-d,--device}'[New key/value to apply to a specific device]' \
- {-e,--ephemeral}'[Ephemeral instance]' \
- '--instance-only[Copy the instance without its snapshots]' \
- '--mode[Transfer mode. One of pull (default), push or relay (default "pull")]' \
- '--no-rofiles[Create the instance with no profiles applied]' \
- {-p,--profile}'[Profile to apply to the new instance]' \
- '--refresh[Perform an incremental copy]' \
- '--stateless[Copy a stateful instance stateless]' \
- {-s,--storage}'[Storage pool name]' \
- '--target[Cluster member name]' \
- '--target-project[Copy to a project different from the source]'
- ;;
- (delete)
- _arguments -C \
- '*:containers:__lxc_containers_stopped'
- ;;
- (exec)
- _arguments -C \
- '1:containers:__lxc_containers_running' \
- '--cwd[Directory to run the command in (default /root)]' \
- {-n,--disable-stdin}'[Disable stdin (reads from /dev/null)]' \
- '--env[Environment variable to set (e.g. HOME=/home/foo)]' \
- {-t,--force-interactive}'[Force pseudo-terminal allocation]' \
- {-T,--force-noninteractive}'[Disable pseudo-terminal allocation]' \
- '--group[Group ID to run the command as (default 0)]' \
- '--mode[Override the terminal mode (auto, interactive or non-interactive) (default "auto")]' \
- '--user[User ID to run the command as (default 0)]'
- ;;
- (export)
- _arguments -C \
- '--compression[Define a compression algorithm: for backup or none]' \
- '--instance-only[Whether or not to only backup the instance (without snapshots)]' \
- '--optimized-storage[Use storage driver optimized format (can only be restored on a similar pool)]'
- ;;
- (file)
- case $words[2] in
- (push)
- _arguments -C \
- '2:files:_files' \
- '3:containers:__lxc_containers_all'
- ;;
- (pull)
- _arguments -C \
- '2:containers:__lxc_containers_all' \
- '3:files:_files'
- ;;
- (edit)
- _arguments -C \
- '2:containers:__lxc_containers_all'
- ;;
- (delete)
- _arguments -C \
- '*:containers:__lxc_containers_all'
- ;;
- esac
- _arguments -C \
- '1: :__lxc_file_commands' \
- "--gid=[Set the file's gid on push]" \
- "--uid=[Set the file's uid on push]" \
- "--mode=[Set the file's perms on push]" \
- ''{-p,--create-dirs}'[Create any directories necessary]' \
- ''{-r,--recursive}'[Recursively push or pull files]'
- ;;
- (help)
- _arguments -C \
- '1: :__lxc_commands'
- ;;
- (image)
- case $words[2] in
- (alias)
- case $words[3] in
- (create)
- _arguments -C \
- '4: :__lxc_images_as_fingerprint'
- ;;
- (list)
- _arguments -C \
- '4: :()' \
- '--format=[Format (csv|json|table|yaml) (default "table")]:Format:(csv json table yaml)'
- ;;
- (delete|rename)
- _arguments -C \
- '3: :__lxc_images_as_alias'
- ;;
- esac
- _arguments -C \
- '2: :__lxc_image_alias_commands'
- ;;
- (delete|refresh)
- _arguments -C \
- '*: :__lxc_images_as_fingerprint'
- ;;
- (edit|show|info|export)
- _arguments -C \
- '2: :__lxc_images_as_fingerprint'
- ;;
- (copy)
- _arguments -C \
- '2: :__lxc_remotes'
- ;;
- (import)
- _arguments -C \
- '2: :_files'
- ;;
- (list)
- l="'Columns' 'l[Shortest image alias (and optionally number of other aliases)]' \
- 'L[Newline-separated list of all image aliases]' 'f[Fingerprint]' \
- 'p[Whether image is public]' 'd[Description]' 'a[Architecture]' \
- 's[Size]' 'u[Upload date]'"
- _arguments -C \
- '3: :()' \
- {-c,--columns=}"[Columns (default lfpdasu)]:Columns:_values -s '' $l" \
- '--format=[Format (csv|json|table|yaml) (default "table")]:Format:(csv json table yaml)'
- ;;
- esac
- _arguments -C \
- '1: :__lxc_image_commands'
- ;;
- (import)
- _arguments -C \
- '1: :_files' \
- {-s,--storage=}'[Storage pool name]'
- ;;
- (info)
- _arguments -C \
- '1:containers:__lxc_containers_all' \
- '--resources[Show the resources available to the server]' \
- "--show-log[Show the container's last 100 log lines?]" \
- '--target[Cluster member name]'
- ;;
- (launch|init)
- _arguments -C \
- '1: :__lxc_images' \
- {-c,--config=}'[Config key/value to apply to the new container (= map\[\])]' \
- '--console=[Immediately attach to the console]' \
- '--empty[Create an empty instance]' \
- {-e,--ephemeral}'[Ephemeral container]' \
- {-n,--network=}'[Network name]' \
- '--no-profiles[Create the instance with no profiles applied]' \
- {-p,--profile=}'[Profile to apply to the new container]' \
- {-s,--storage=}'[Storage pool name]' \
- '--target=[Node name]' \
- {-t,--type=}'[Instance type]' \
- '--vm[Create a virtual machine]'
- ;;
- (list)
- # c.f https://github.com/lxc/lxd/blob/master/lxc/list.go
- local _l="'Columns' '4[IPv4 address]' '6[IPv6 address]' 'a[Architecture]' 'b[Storage pool]' \
- 'c[Creation date]' 'd[Description]' 'l[Last used date]' 'n[Name]' 'N[Number of Processes]' \
- \"p[PID of the container's init process]\" 'P[Profiles]' 's[State]' \
- 'S[Number of snapshots]' 't[Type (persistent or ephemeral)]' \
- 'L[Location of the container (e.g. its cluster member)]'"
- _arguments -C \
- {-c,--columns=}"[Columns (default: ns46tSL)]:Columns:_values -s '' $_l" \
- '--fast[Fast mode (same as --columns=nsacPt)]' \
- '--format=[Format (csv|json|table|yaml) (default "table")]:Format:(csv json table yaml)' \
- '--no-alias[Ignore aliases when determining what command to run]'
- ;;
- (manpage)
- _arguments -C \
- '1:Directory to put manpage to:_files'
- ;;
- (monitor)
- _arguments -C \
- '1: :__lxc_containers_all' \
- '--loglevel=[Minimum level for log messages]:Log level:(info)' \
- '--pretty[Pretty rendering]' \
- '--type=[Event type to listen for]:Type:(lifecycle logging)'
- ;;
- (move)
- _arguments -C \
- {-c,--config}'[Config key/value to apply to the target instance]' \
- {-d,--device}'[New key/value to apply to a specific device]' \
- '--instance-only[Move the instance without its snapshots]' \
- '--mode{Transfer mode. One of pull (default), push or relay. (default "pull")}' \
- '--no-profiles[Unset all profiles on the target instance]' \
- {-p,--profile}'[Profile to apply to the target instance]' \
- --stateless'[Copy a stateful instance stateless]' \
- {-s,--storage}'[Storage pool name]' \
- '--target[Cluster member name]' \
- '--target-project[Copy to a project different from the source]'
- ;;
- (network)
- _arguments -C \
- '1: :__lxc_network_commands'
- ;;
- (operation)
- # TODO: complete operation items
- _arguments -C \
- '1: :__lxc_operation_commands'
- ;;
- (pause)
- _arguments -C \
- '1: :__lxc_containers_running' \
- '--all[Run command against all containers]'
- ;;
- (project)
- case $words[2] in
- (edit|delete|switch|rename|show|get|set)
- _arguments -C \
- '2: :__lxc_projects'
- ;;
- (list|ls)
- _arguments -C \
- '3: :()' \
- '--format=[Format (csv|json|table|yaml) (default "table")]:Format:(csv json table yaml)'
- ;;
- esac
- _arguments -C \
- '1: :__lxc_project_commands'
- ;;
- (profile)
- case $words[2] in
- (add)
- _arguments -C \
- '2: :__lxc_containers_all' \
- '3: :__lxc_profiles' \
- ;;
- (assign|apply)
- _arguments -C \
- '2: :__lxc_containers_all' \
- "3: :_values -s , Profiles $(__get_lxc_profiles)"
- ;;
- (copy|cp)
- _arguments -C \
- '2: :__lxc_profiles' \
- '3: :__lxc_profiles'
- ;;
- (delete|rm|edit|show)
- _arguments -C \
- '2: :__lxc_profiles'
- ;;
- (get|set|unset)
- # TODO: complete profile keys
- _arguments -C \
- '2: :__lxc_profiles'
- ;;
- (list|ls)
- # TODO: complete container profiles
- _arguments -C \
- '2: :__lxc_remotes'
- ;;
- (rename|mv)
- # TODO: complete container profiles
- _arguments -C \
- '2: :__lxc_profiles'
- ;;
- esac
- _arguments -C \
- '1: :__lxc_profile_commands'
- ;;
- (publish)
- # TODO: complete publish
- _arguments -C \
- '1: :__lxc_containers_all'
- ;;
- (query)
- _arguments -C \
- {-d,--data}'[Input data]' \
- '--raw[Print the raw response]' \
- {-X,--request}'[Action (defaults to GET) (default "GET")]' \
- '--wait[Wait for the operation to complete]'
- ;;
- (remote)
- case $words[2] in
- (set-default|set-url|rename|remove)
- _arguments -C \
- '2: :__lxc_remotes'
- ;;
- (add)
- _arguments -C \
- '2: :()' \
- '--accept-certificate[Accept certificate]' \
- '--auth-type=[Server authentication type (tls or macaroons)]:Auth type:(tls macaroons)' \
- '--password[Remote admin password]' \
- '--protocol=[Server protocol (lxd or simplestreams)]:Protocol:(tls macaroons)' \
- '--public[Public image server]'
- ;;
- esac
- _arguments -C \
- '1: :__lxc_remote_commands'
- ;;
- (rename)
- _arguments -C \
- '1:containers:__lxc_containers_stopped' \
- ;;
- (restart)
- _arguments -C \
- '*:containers:__lxc_containers_running' \
- {-f,--force}'[Force the container to shutdown]' \
- '--timeout[Time to wait for the container before killing it]' \
- $opt_container_control
- ;;
- (restore)
- _arguments -C \
- '1:containers:__lxc_containers_all' \
- '--stateful[Store the container state (only for stop)]'
- ;;
- (shell)
- _arguments -C \
- '1:containers:__lxc_containers_running' \
- '--cwd[Directory to run the command in (default /root)]' \
- {-n,--disable-stdin}'[Disable stdin (reads from /dev/null)]' \
- '--env[Environment variable to set (e.g. HOME=/home/foo)]' \
- {-t,--force-interactive}'[Force pseudo-terminal allocation]' \
- {-T,--force-noninteractive}'[Disable pseudo-terminal allocation]' \
- '--group[Group ID to run the command as (default 0)]' \
- '--mode[Override the terminal mode (auto, interactive or non-interactive) (default "auto")]' \
- '--user[User ID to run the command as (default 0)]'
- ;;
- (snapshot)
- _arguments -C \
- '1:containers:__lxc_containers_all'
- ;;
- (start)
- _arguments -C \
- '*:containers:__lxc_containers_stopped' \
- $opt_container_control
- ;;
- (stop)
- _arguments -C \
- '*:containers:__lxc_containers_running' \
- '--timeout[Time to wait for the container before killing it (= -1)]' \
- {-f,--force}'[Force the container to shutdown]' \
- $opt_container_control
- ;;
- (storage)
- case $words[2] in
- (delete|edit|get|info|set|unset)
- _arguments -C \
- '2: :__lxc_storages'
- ;;
- (volume)
- case $words[3] in
- (list)
- _arguments -C \
- '3: :__lxc_storages'
- ;;
- esac
- _arguments -C \
- '2: :__lxc_storage_volume_commands'
- ;;
- esac
- _arguments -C \
- '1: :__lxc_storage_commands'
- ;;
- (version)
- # nop
- ;;
- esac
- ;;
- esac
- _arguments -C -A '-*' \
- '*: :__lxc_global_flags'
- return 0
-}
-
-__lxc_global_flags() {
- local -a _l=(
- '--debug:Show all debug messages'
- '--force-local:Force using the local unix socket'
- {-h,--help}':Print help'
- '--project:Override the source project'
- {-q,--quiet}":Don't show progress information"
- {-v,--verbose}':Show all information messages'
- # '--version:Print version number'
- )
- _describe -o -t global_options 'global option' _l
-}
-
-__lxc_commands() {
- local -a _l=(
- 'alias:Manage command aliases'
- 'cluster:Manage cluster nodes'
- 'config:Change container or server configuration options'
- "console:Interact with the container's console device and log"
- 'copy:Copy containers within or in between LXD instances'
- 'delete:Delete containers and snapshots'
- 'exec:Execute commands in containers'
- 'export:Export instance backups'
- 'file:Manage files in containers'
- 'help:Help about any command'
- # 'finger:Check if the LXD server is alive' # old sub command
- 'image:Manipulate container images'
- 'import:Import instance backups'
- 'info:Show container or server information'
- 'init:Create containers from images'
- 'launch:Create and start containers from images'
- 'list:List the existing containers'
- 'manpage:Generate all the LXD manpages'
- 'monitor:Monitor a local or remote LXD server'
- 'move:Move containers within or in between LXD instances'
- 'network:Manage and attach containers to networks'
- 'operation:List, show and delete background operations'
- 'pause:Pause containers'
- 'profile:Manage container configuration profiles'
- 'project:Manage projects'
- 'publish:Publish containers as images'
- 'query:Send a raw query to LXD'
- 'remote:Manage the list of remote LXD servers'
- 'rename:Rename a container or snapshot'
- 'restart:Restart containers'
- 'restore:Restore containers from snapshots'
- 'snapshot:Create container snapshots'
- 'shell:Execute commands in instances'
- 'start:Start containers'
- 'stop:Stop containers'
- 'storage:Manage storage pools and volumes'
- 'version:Print the version number of this client tool'
- )
- _describe -t commands Commands _l
-}
-
-__lxc_alias_commands() {
- local -a _l=(
- 'add:Add a new alias <alias> pointing to <target>.'
- 'remove:Remove the alias <alias>.'
- 'list:List all the aliases.'
- 'rename:Rename remote <old alias> to <new alias>.'
- )
- _describe -t commands 'Alias commands' _l
-}
-
-__lxc_cluster_commands() {
- local -a _l=(
- 'edit:Edit cluster member configurations as YAML'
- 'enable:Enable clustering on a single non-clustered LXD server'
- 'list:List all the cluster members'
- 'remove:Remove a member from the cluster'
- 'rename:Rename a cluster member'
- 'show:Show details of a cluster member'
- )
- _describe -t commands 'Cluster commands' _l
-}
-
-__lxc_config_commands() {
- local -a _l=(
- 'get:Get container or server configuration key'
- 'set:Set container or server configuration key'
- 'unset:Unset container or server configuration key'
- 'show:Show container or server configuration'
- 'edit:Edit container or server configuration key'
- 'metadata:Container metadata'
- 'template:Container templates'
- 'device:Device management'
- 'trust:Client trust store management'
- )
- _describe -t commands 'Config commands' _l
-}
-
-__lxc_config_device_commands() {
- local -a _l=(
- 'add:Add a device to a container'
- 'get:Get a device property'
- 'set:Set a device property'
- 'unset:Unset a device property'
- 'override:Copy a profile inherited device into local container config'
- 'list:List devices for container'
- 'show:Show full device details for container'
- 'remove:Remove device from container'
- )
- _describe -t commands 'Config device commands' _l
-}
-
-
-__lxc_config_metadata_commands() {
- local -a _l
- _c=(
- 'show:Show the container metadata.yaml content'
- 'edit:Edit the container metadata.yaml, either by launching external editor or reading STDIN'
- )
- _describe -t commands 'Config metadata commands' _l
-}
-
-__lxc_config_template_commands() {
- local -a _l=(
- 'list:List the names of template files for a container.'
- 'show:Show the content of a template file for a container'
- 'create:Add an empty template file for a container'
- 'edit:Edit the content of a template file for a container, either by launching external editor or reading STDIN'
- 'delete:Delete a template file for a container'
-
- )
- _describe -t commands 'Config template commands' _l
-}
-
-__lxc_config_trust_commands() {
- local -a _l=(
- 'list:List all trusted certs'
- 'add:Add certfile.crt to trusted hosts'
- 'remove:Remove the cert from trusted hosts'
- )
- _describe -t commands 'Config trust commands' _l
-}
-
-__lxc_file_commands() {
- local -a _l=(
- 'pull:Pull file from container'
- 'push:Push file to container'
- 'delete:Delete files in containers.'
- 'edit:Edit files in containers using the default text editor'
- )
- _describe -t commands 'File commands' _l
-}
-
-__lxc_image_commands() {
- local -a _l=(
- 'copy:Copy an image from one LXD daemon to another over the network'
- 'delete:Delete one or more images from the LXD image store'
- 'import:Import images into the image store'
- 'export:Export an image from the LXD image store into a distributable tarball'
- 'info:Print everything LXD knows about a given image'
- 'list:List images in the LXD image store. Filters may be of the'
- 'show:Yaml output of the user modifiable properties of an image'
- 'edit:Edit image, either by launching external editor or reading STDIN'
- 'alias:Manage alias for image in the LXD image store'
- 'refresh:Refresh images'
- )
- _describe -t commands 'Image commands' _l
-}
-
-__lxc_image_alias_commands() {
- local -a _l=(
- 'create:Create aliases for existing images'
- 'rename:Rename aliases'
- 'delete:Delete image alias'
- 'list:List image aliases'
- )
- _describe -t commands 'Image alias commands' _l
-}
-
-__lxc_profile_commands() {
- local -a _l=(
- 'add:Add profiles to containers'
- 'assign:Assign sets of profiles to containers'
- 'copy:Copy profiles'
- 'create:Create profiles'
- 'delete:Delete profiles'
- 'device:Manage container devices'
- 'edit:Edit profile configurations as YAML'
- 'get:Get values for profile configuration keys'
- 'list:List profiles'
- 'remove:Remove profiles from containers'
- 'rename:Rename profiles'
- 'set:Set profile configuration keys'
- 'show:Show profile configurations'
- 'unset:Unset profile configuration keys'
- )
- _describe -t commands 'Profile commands' _l
-}
-
-__lxc_remote_commands() {
- local -a _l=(
- 'add:Add the remote <remote> at <url>'
- 'remove:Remove the remote <remote>'
- 'list:List all remotes'
- 'rename:Rename remote <old name> to <new name>'
- "set-url:Update <remote>'s url to <url>"
- 'set-default:Set the default remote'
- 'get-default:Print the default remote'
- )
- _describe -t commands 'Remote commands' _l
-}
-
-__lxc_network_commands() {
- local -a _l=(
- 'attach:Attach network interfaces to containers'
- 'attach-profile:Attach network interfaces to profiles'
- 'create:Create new networks'
- 'delete:Delete networks'
- 'detach:Detach network interfaces from containers'
- 'detach-profile:Detach network interfaces from profiles'
- 'edit:Edit network configurations as YAML'
- 'get:Get values for network configuration keys'
- 'info:Get runtime information on networks'
- 'list:List available networks'
- 'list-leases:List DHCP leases'
- 'rename:Rename networks'
- 'set:Set network configuration keys'
- 'show:Show network configurations'
- 'unset:Unset network configuration keys'
- )
- _describe -t commands 'Network commands' _l
-}
-
-__lxc_operation_commands() {
- local -a _l=(
- 'delete:Delete a background operation (will attempt to cancel)'
- 'list:List background operations'
- 'show:Show details on a background operation'
- )
- _describe -t commands 'Operation commands' _l
-}
-
-__lxc_storage_commands() {
- local -a _l=(
- 'create:Create storage pools'
- 'delete:Delete storage pools'
- 'edit:Edit storage pool configurations as YAML'
- 'get:Get values for storage pool configuration keys'
- 'info:Show useful information about storage pools'
- 'list:List available storage pools'
- 'set:Set storage pool configuration keys'
- 'show:Show storage pool configurations and resources'
- 'unset:Unset storage pool configuration keys'
- 'volume:Manage storage volumes'
- )
- _describe -t commands 'Storage commands' _l
-}
-
-__lxc_storage_volume_commands() {
- local -a _l=(
- 'attach:Attach new storage volumes to containers'
- 'attach-profile:Attach new storage volumes to profiles'
- 'copy:Copy storage volumes'
- 'create:Create new custom storage volumes'
- 'delete:Delete storage volumes'
- 'detach:Detach storage volumes from containers'
- 'detach-profile Detach storage volumes from profiles'
- 'edit:Edit storage volume configurations as YAML'
- 'get:Get values for storage volume configuration keys'
- 'list:List storage volumes'
- 'move:Move storage volumes between pools'
- 'rename:Rename storage volumes and storage volume snapshots'
- 'restore:Restore storage volume snapshots'
- 'set:Set storage volume configuration keys'
- 'show:Show storage volum configurations'
- 'snapshot:Snapshot storage volumes'
- 'unset:Unset storage volume configuration keys'
- )
- _describe -t commands 'Storage volume commands' _l
-}
-
-__lxc_project_commands() {
- local -a _l=(
- 'create:Create projects'
- 'delete:Delete projects'
- 'edit:Edit project configurations as YAML'
- 'get:Get values for project configuration keys'
- 'list:List projects'
- 'rename:Rename projects'
- 'set:Set project configuration keys'
- 'show:Show project options'
- 'switch:Switch the current project'
- 'unset:Unset project configuration keys'
- )
- _describe -t commands 'Project commands' _l
-}
-
-__lxc_devices_by_container () {
- local -a _l=(${(f)"$(_call_program devices lxc config device list $selected_container)"})
- _describe "Devices of $selected_container" _l
-}
-
-__lxc_list_columns () {
- local -a _l=(
- '4:IPv4 address'
- '6:IPv6 address'
- 'a:Architecture'
- 'b:Storage pool'
- 'c:Creation date'
- 'd:Description'
- 'l:Last used date'
- 'n:Name'
- 'N:Number of Processes'
- "p:PID of the container's init process"
- 'P:Profiles'
- 's:State'
- 'S:Number of snapshots'
- 't:Type (persistent or ephemeral)'
- 'L:Location of the container (e.g. its cluster member)'
- )
- _describe "Columns" _l
-}
-
-__lxc_device_types () {
- local -a _l=(
- 'none:Inheritance blocker'
- 'nic:Network interface'
- 'disk:Mountpoint inside the container'
- 'unix-char:Unix character device'
- 'unix-block:Unix block device'
- 'usb:USB device'
- 'gpu:GPU device'
- 'infiniband:Infiniband device'
- 'proxy:Proxy device'
- )
- _describe 'Device types' _l
-}
-
-__lxc_containers_running () {
- local -a _l=(${(@f)"$(_call_program containers lxc list --fast | tail -n +4 | awk '{print $2 $4}' | grep -E 'RUNNING$' | sed -e "s/RUNNING//")"})
- _describe -t containers 'Running Containers' _l
-}
-
-__lxc_containers_stopped () {
- local -a _l=(${(@f)"$(_call_program containers lxc list --fast | tail -n +4 | awk '{print $2 $4}' | grep -E 'STOPPED$' | sed -e "s/STOPPED//")"})
- _describe -t containers 'Stopped containers' _l
-}
-
-__lxc_containers_all () {
- local -a _l=(${(@f)"$(_call_program containers lxc list --fast | tail -n +4 | awk '{print $2}' | grep -E -v '^(\||^$)')"})
- _describe -t containers 'All containers' _l
-}
-
-__lxc_images_as_fingerprint () {
- # local -a _l=(${(@f)"$(_call_program images lxc image list | tail -n +4 | egrep -e '^\|' | awk '{split($0,a,"|"); for(i in a){ sub(/^[ \t]+/,"",a[i]);sub(/[ \t]+$/,"",a[i]);}; (a[2]=="") ? b=" (not aliased)" : b=" (aliased as " a[2] ")" ; print a[3] ":" a[5] b }' )"})
-
- local -a _l
- _call_program images lxc image list --format=csv | sed -e 's/:/\\:/g' | while read line
- do
- local alias=$(echo $line| cut -d ',' -f 1)
- if [ -n "$alias" ]; then
- suffix="$alias"
- else
- suffix='(not aliased)'
- fi
- _l=($_l "$(echo $line | awk -F ',' '{printf "%s:%-44s -- ",$2,$4}')$suffix")
- done
-
- _describe -t images_as_fingerprint 'Images as fingerprint' _l
-}
-
-__lxc_images_as_alias () {
- # local -a _l=(${(@f)"$(_call_program images lxc image alias list | tail -n +4 | egrep -e '^\|' | awk '{split($0,a,"|"); for(i in a){ sub(/^[ \t]+/,"",a[i]);sub(/[ \t]+$/,"",a[i]);}; (a[4]=="") ? b="" : b=" - " a[4] ;print a[2] ":" a[3] b }' )"})
-
- local -a _l
- _call_program images lxc image list --format=csv | sed -e 's/:/\\:/g' | while read line
- do
- local alias=$(echo $line| cut -d ',' -f 1)
- if [ -n "$alias" ]; then
- _l=($_l "$(echo $line | awk -F ',' '{printf "%s: %s -- %s",$1,$2,$4}')")
- fi
- done
- _describe -t images_as_alias 'Images as alias' _l
-}
-
-__lxc_images () {
- __lxc_images_as_alias
- __lxc_images_as_fingerprint
-}
-
-__lxc_aliases () {
- local -a _l=(${(@f)"$(_call_program aliases lxc alias list | tail -n +4 | grep -E '^\|' | awk '{print $2 ":" $4}')"})
- _describe -t aliases 'Aliases' _l
-}
-
-__lxc_remotes () {
- local -a _l=(${(@f)"$(_call_program remotes lxc remote list | tail -n +4 | grep -E -e '^\|' | sed -e 's/(default)//' | awk '{print $2 ":" $4}')"})
- _describe -t remotes 'Remotes' _l
-}
-
-__lxc_profiles () {
- local -a _l=(${(@f)"$(_call_program profiles lxc profile list | tail -n +4 | grep -E -e '^\|' | awk '{print $2 ":used by " $4 " containers" }' )"})
- _describe -t profiles 'Profiles' _l
-}
-
-__lxc_projects() {
- local -a _l=(${(@f)"$(_call_program profiles lxc project list --format=csv | cut -d ',' -f 1 | sed -e 's/ (current)/:current/')"})
- _describe -t profiles 'Projects' _l
-}
-
-__lxc_storages () {
- local -a _l=(${(@f)"$(_call_program profiles lxc storage list | tail -n +4 | grep -E -e '^\|' | awk '{print $2 }')"})
- _describe -t storages 'Storages' _l
-}
-
-__get_lxc_keys_by_device () {
- typeset -A hash
- hash[nic]="(nictype limits.ingress limits.egress limits.max name host_name hwaddr mtu \
- parent vlan ipv4.address ipv6.address security.mac_filtering maas.subnet.ipv4 maas.subnet.ipv6)"
- hash[infiniband]="(nictype name hwaddr mtu parent)"
- hash[disk]="(limits.read limits.write limits.max path source optional readonly size recursive pool)"
- hash[unix-char]="(source path major minor uid gid mode required)"
- hash[unix-block]="(source path major minor uid gid mode required)"
- hash[usb]="(vendorid productid uid gid mode required)"
- hash[gpu]="(vendorid productid id pci uid gid mode)"
- hash[proxy]="(listen bind connect)"
- echo "$hash[$1]"
-}
-
-__get_lxc_templates_by_container () {
- lxc config template list $1 | tail -n +4 | grep -E '^\|' | awk '{print $2}'
-}
-
-__get_lxc_profiles () {
- lxc profile list | tail -n +4 | grep -E -e '^\|' | awk '{print $2}' | paste -sd " "
-}
-
-compdef _lxc lxc
diff --git a/.config/zsh/completion/_lxd b/.config/zsh/completion/_lxd
deleted file mode 100644
index 1a62c3b..0000000
--- a/.config/zsh/completion/_lxd
+++ /dev/null
@@ -1,47 +0,0 @@
-#compdef lxd
-
-# _lxd
-#
-# Copyright (c) 2020 endaaman
-#
-# This software may be modified and distributed under the terms
-# of the MIT license. See the LICENSE file for details.
-
-_lxd() {
- _arguments -C \
- '1: :__lxd_commands' \
- '*: :__lxd_global_flags'
-}
-
-
-__lxd_global_flags() {
- local -a _c
- _c=(
- {-d,--debug}':Show all debug messages'
- '--group:The group of users that will be allowed to talk to LXD'
- {-h,--help}':Print help'
- '--logfile:Path to the log file'
- '--syslog:Log to syslog'
- '--trace:Log tracing targets'
- )
- _describe -o -t global_options 'Flags' _c
-}
-
-
-
-__lxd_commands() {
- local -a _c
- _c=(
- 'activateifneeded:Check if LXD should be started'
- 'cluster:Low-level cluster administration commands'
- 'help:Help about any command'
- 'import:Import existing containers'
- 'init:Configure the LXD daemon'
- 'shutdown:Tell LXD to shutdown all containers and exit'
- 'version:Show the server version'
- 'waitready:Wait for LXD to be ready to process requests'
- )
- _describe -t commands 'Commands' _c
-}
-
-compdef _lxd lxd
diff --git a/.zfunc/_fnm b/.zfunc/_fnm
deleted file mode 100644
index 014fc03..0000000
--- a/.zfunc/_fnm
+++ /dev/null
@@ -1,357 +0,0 @@
-#compdef fnm
-
-autoload -U is-at-least
-
-_fnm() {
- typeset -A opt_args
- typeset -a _arguments_options
- local ret=1
-
- if is-at-least 5.2; then
- _arguments_options=(-s -S -C)
- else
- _arguments_options=(-s -C)
- fi
-
- local context curcontext="$curcontext" state line
- _arguments "${_arguments_options[@]}" \
-'--node-dist-mirror=[https://nodejs.org/dist/ mirror]' \
-'--fnm-dir=[The root directory of fnm installations]' \
-'--multishell-path=[Where the current node version link is stored. This value will be populated automatically by evaluating `fnm env` in your shell profile. Read more about it using `fnm help env`]' \
-'--log-level=[The log level of fnm commands]' \
-'--arch=[Override the architecture of the installed Node binary. Defaults to arch of fnm binary]' \
-'-h[Prints help information]' \
-'--help[Prints help information]' \
-'-V[Prints version information]' \
-'--version[Prints version information]' \
-":: :_fnm_commands" \
-"*::: :->fnm" \
-&& ret=0
- case $state in
- (fnm)
- words=($line[1] "${words[@]}")
- (( CURRENT += 1 ))
- curcontext="${curcontext%:*:*}:fnm-command-$line[1]:"
- case $line[1] in
- (ls-remote)
-_arguments "${_arguments_options[@]}" \
-'--node-dist-mirror=[https://nodejs.org/dist/ mirror]' \
-'--fnm-dir=[The root directory of fnm installations]' \
-'--log-level=[The log level of fnm commands]' \
-'--arch=[Override the architecture of the installed Node binary. Defaults to arch of fnm binary]' \
-'-h[Prints help information]' \
-'--help[Prints help information]' \
-'-V[Prints version information]' \
-'--version[Prints version information]' \
-&& ret=0
-;;
-(list-remote)
-_arguments "${_arguments_options[@]}" \
-'--node-dist-mirror=[https://nodejs.org/dist/ mirror]' \
-'--fnm-dir=[The root directory of fnm installations]' \
-'--log-level=[The log level of fnm commands]' \
-'--arch=[Override the architecture of the installed Node binary. Defaults to arch of fnm binary]' \
-'-h[Prints help information]' \
-'--help[Prints help information]' \
-'-V[Prints version information]' \
-'--version[Prints version information]' \
-&& ret=0
-;;
-(ls)
-_arguments "${_arguments_options[@]}" \
-'--node-dist-mirror=[https://nodejs.org/dist/ mirror]' \
-'--fnm-dir=[The root directory of fnm installations]' \
-'--log-level=[The log level of fnm commands]' \
-'--arch=[Override the architecture of the installed Node binary. Defaults to arch of fnm binary]' \
-'-h[Prints help information]' \
-'--help[Prints help information]' \
-'-V[Prints version information]' \
-'--version[Prints version information]' \
-&& ret=0
-;;
-(list)
-_arguments "${_arguments_options[@]}" \
-'--node-dist-mirror=[https://nodejs.org/dist/ mirror]' \
-'--fnm-dir=[The root directory of fnm installations]' \
-'--log-level=[The log level of fnm commands]' \
-'--arch=[Override the architecture of the installed Node binary. Defaults to arch of fnm binary]' \
-'-h[Prints help information]' \
-'--help[Prints help information]' \
-'-V[Prints version information]' \
-'--version[Prints version information]' \
-&& ret=0
-;;
-(install)
-_arguments "${_arguments_options[@]}" \
-'--node-dist-mirror=[https://nodejs.org/dist/ mirror]' \
-'--fnm-dir=[The root directory of fnm installations]' \
-'--log-level=[The log level of fnm commands]' \
-'--arch=[Override the architecture of the installed Node binary. Defaults to arch of fnm binary]' \
-'--lts[Install latest LTS]' \
-'-h[Prints help information]' \
-'--help[Prints help information]' \
-'-V[Prints version information]' \
-'--version[Prints version information]' \
-'::version -- A version string. Can be a partial semver or a LTS version name by the format lts/NAME:_files' \
-&& ret=0
-;;
-(use)
-_arguments "${_arguments_options[@]}" \
-'--node-dist-mirror=[https://nodejs.org/dist/ mirror]' \
-'--fnm-dir=[The root directory of fnm installations]' \
-'--log-level=[The log level of fnm commands]' \
-'--arch=[Override the architecture of the installed Node binary. Defaults to arch of fnm binary]' \
-'--install-if-missing[Install the version if it isn'\''t installed yet]' \
-'-h[Prints help information]' \
-'--help[Prints help information]' \
-'-V[Prints version information]' \
-'--version[Prints version information]' \
-'::version:_files' \
-&& ret=0
-;;
-(env)
-_arguments "${_arguments_options[@]}" \
-'--shell=[The shell syntax to use. Infers when missing]: :(bash zsh fish powershell)' \
-'--node-dist-mirror=[https://nodejs.org/dist/ mirror]' \
-'--fnm-dir=[The root directory of fnm installations]' \
-'--log-level=[The log level of fnm commands]' \
-'--arch=[Override the architecture of the installed Node binary. Defaults to arch of fnm binary]' \
-'--multi[Deprecated. This is the default now]' \
-'--use-on-cd[Print the script to change Node versions every directory change]' \
-'-h[Prints help information]' \
-'--help[Prints help information]' \
-'-V[Prints version information]' \
-'--version[Prints version information]' \
-&& ret=0
-;;
-(completions)
-_arguments "${_arguments_options[@]}" \
-'--shell=[The shell syntax to use. Infers when missing]: :(zsh bash fish powershell elvish)' \
-'--node-dist-mirror=[https://nodejs.org/dist/ mirror]' \
-'--fnm-dir=[The root directory of fnm installations]' \
-'--log-level=[The log level of fnm commands]' \
-'--arch=[Override the architecture of the installed Node binary. Defaults to arch of fnm binary]' \
-'-h[Prints help information]' \
-'--help[Prints help information]' \
-'-V[Prints version information]' \
-'--version[Prints version information]' \
-&& ret=0
-;;
-(alias)
-_arguments "${_arguments_options[@]}" \
-'--node-dist-mirror=[https://nodejs.org/dist/ mirror]' \
-'--fnm-dir=[The root directory of fnm installations]' \
-'--log-level=[The log level of fnm commands]' \
-'--arch=[Override the architecture of the installed Node binary. Defaults to arch of fnm binary]' \
-'-h[Prints help information]' \
-'--help[Prints help information]' \
-'-V[Prints version information]' \
-'--version[Prints version information]' \
-':to-version:_files' \
-':name:_files' \
-&& ret=0
-;;
-(default)
-_arguments "${_arguments_options[@]}" \
-'--node-dist-mirror=[https://nodejs.org/dist/ mirror]' \
-'--fnm-dir=[The root directory of fnm installations]' \
-'--log-level=[The log level of fnm commands]' \
-'--arch=[Override the architecture of the installed Node binary. Defaults to arch of fnm binary]' \
-'-h[Prints help information]' \
-'--help[Prints help information]' \
-'-V[Prints version information]' \
-'--version[Prints version information]' \
-':version:_files' \
-&& ret=0
-;;
-(current)
-_arguments "${_arguments_options[@]}" \
-'--node-dist-mirror=[https://nodejs.org/dist/ mirror]' \
-'--fnm-dir=[The root directory of fnm installations]' \
-'--log-level=[The log level of fnm commands]' \
-'--arch=[Override the architecture of the installed Node binary. Defaults to arch of fnm binary]' \
-'-h[Prints help information]' \
-'--help[Prints help information]' \
-'-V[Prints version information]' \
-'--version[Prints version information]' \
-&& ret=0
-;;
-(exec)
-_arguments "${_arguments_options[@]}" \
-'--using=[Either an explicit version, or a filename with the version written in it]' \
-'--node-dist-mirror=[https://nodejs.org/dist/ mirror]' \
-'--fnm-dir=[The root directory of fnm installations]' \
-'--log-level=[The log level of fnm commands]' \
-'--arch=[Override the architecture of the installed Node binary. Defaults to arch of fnm binary]' \
-'--using-file[Deprecated. This is the default now]' \
-'-h[Prints help information]' \
-'--help[Prints help information]' \
-'-V[Prints version information]' \
-'--version[Prints version information]' \
-'::arguments -- The command to run:_files' \
-&& ret=0
-;;
-(uninstall)
-_arguments "${_arguments_options[@]}" \
-'--node-dist-mirror=[https://nodejs.org/dist/ mirror]' \
-'--fnm-dir=[The root directory of fnm installations]' \
-'--log-level=[The log level of fnm commands]' \
-'--arch=[Override the architecture of the installed Node binary. Defaults to arch of fnm binary]' \
-'-h[Prints help information]' \
-'--help[Prints help information]' \
-'-V[Prints version information]' \
-'--version[Prints version information]' \
-'::version:_files' \
-&& ret=0
-;;
-(help)
-_arguments "${_arguments_options[@]}" \
-'--node-dist-mirror=[https://nodejs.org/dist/ mirror]' \
-'--fnm-dir=[The root directory of fnm installations]' \
-'--log-level=[The log level of fnm commands]' \
-'--arch=[Override the architecture of the installed Node binary. Defaults to arch of fnm binary]' \
-'-h[Prints help information]' \
-'--help[Prints help information]' \
-'-V[Prints version information]' \
-'--version[Prints version information]' \
-&& ret=0
-;;
- esac
- ;;
-esac
-}
-
-(( $+functions[_fnm_commands] )) ||
-_fnm_commands() {
- local commands; commands=(
- "list-remote:List all remote Node.js versions" \
-"ls-remote:List all remote Node.js versions" \
-"list:List all locally installed Node.js versions" \
-"ls:List all locally installed Node.js versions" \
-"install:Install a new Node.js version" \
-"use:Change Node.js version" \
-"env:Print and set up required environment variables for fnm" \
-"completions:Print shell completions to stdout" \
-"alias:Alias a version to a common name" \
-"default:Set a version as the default version" \
-"current:Print the current Node.js version" \
-"exec:Run a command within fnm context" \
-"uninstall:Uninstall a Node.js version" \
-"help:Prints this message or the help of the given subcommand(s)" \
- )
- _describe -t commands 'fnm commands' commands "$@"
-}
-(( $+functions[_fnm__alias_commands] )) ||
-_fnm__alias_commands() {
- local commands; commands=(
-
- )
- _describe -t commands 'fnm alias commands' commands "$@"
-}
-(( $+functions[_fnm__completions_commands] )) ||
-_fnm__completions_commands() {
- local commands; commands=(
-
- )
- _describe -t commands 'fnm completions commands' commands "$@"
-}
-(( $+functions[_fnm__current_commands] )) ||
-_fnm__current_commands() {
- local commands; commands=(
-
- )
- _describe -t commands 'fnm current commands' commands "$@"
-}
-(( $+functions[_fnm__default_commands] )) ||
-_fnm__default_commands() {
- local commands; commands=(
-
- )
- _describe -t commands 'fnm default commands' commands "$@"
-}
-(( $+functions[_fnm__env_commands] )) ||
-_fnm__env_commands() {
- local commands; commands=(
-
- )
- _describe -t commands 'fnm env commands' commands "$@"
-}
-(( $+functions[_fnm__exec_commands] )) ||
-_fnm__exec_commands() {
- local commands; commands=(
-
- )
- _describe -t commands 'fnm exec commands' commands "$@"
-}
-(( $+functions[_fnm__help_commands] )) ||
-_fnm__help_commands() {
- local commands; commands=(
-
- )
- _describe -t commands 'fnm help commands' commands "$@"
-}
-(( $+functions[_fnm__install_commands] )) ||
-_fnm__install_commands() {
- local commands; commands=(
-
- )
- _describe -t commands 'fnm install commands' commands "$@"
-}
-(( $+functions[_fnm__list_commands] )) ||
-_fnm__list_commands() {
- local commands; commands=(
-
- )
- _describe -t commands 'fnm list commands' commands "$@"
-}
-(( $+functions[_fnm__list-remote_commands] )) ||
-_fnm__list-remote_commands() {
- local commands; commands=(
-
- )
- _describe -t commands 'fnm list-remote commands' commands "$@"
-}
-(( $+functions[_fnm__ls_commands] )) ||
-_fnm__ls_commands() {
- local commands; commands=(
-
- )
- _describe -t commands 'fnm ls commands' commands "$@"
-}
-(( $+functions[_ls_commands] )) ||
-_ls_commands() {
- local commands; commands=(
-
- )
- _describe -t commands 'ls commands' commands "$@"
-}
-(( $+functions[_fnm__ls-remote_commands] )) ||
-_fnm__ls-remote_commands() {
- local commands; commands=(
-
- )
- _describe -t commands 'fnm ls-remote commands' commands "$@"
-}
-(( $+functions[_ls-remote_commands] )) ||
-_ls-remote_commands() {
- local commands; commands=(
-
- )
- _describe -t commands 'ls-remote commands' commands "$@"
-}
-(( $+functions[_fnm__uninstall_commands] )) ||
-_fnm__uninstall_commands() {
- local commands; commands=(
-
- )
- _describe -t commands 'fnm uninstall commands' commands "$@"
-}
-(( $+functions[_fnm__use_commands] )) ||
-_fnm__use_commands() {
- local commands; commands=(
-
- )
- _describe -t commands 'fnm use commands' commands "$@"
-}
-
-_fnm "$@" \ No newline at end of file
diff --git a/.zfunc/_pip b/.zfunc/_pip
deleted file mode 100644
index c001bed..0000000
--- a/.zfunc/_pip
+++ /dev/null
@@ -1,318 +0,0 @@
-#compdef -P pip[0-9.]#
-#
-# Completion script for pip (http://pypi.python.org/pypi/pip).
-#
-# Taken from https://github.com/zsh-users/zsh-completions/commit/890f3701
-# (where it got removed). Original source:
-# https://github.com/technolize/zsh-completion-funcs.
-#
-# Currently maintained in https://gist.github.com/blueyed/54a257c411310a28805a.
-
-# Setup $python, based on pip version from word[1].
-# Must get done early, otherwise $words might have been changed already.
-local python pip
-pip=${words[1]}
-python=${${pip}/pip/python}
-[[ $python == $pip ]] && python=python
-
-
-# The index(es) to use. The simple index only provides a full list, while
-# the xmlrpc index can be queried by "last updated in".
-# This should be probably made configurable through zstyle and then be used
-# in the cache name.
-# For the xmlrpc index, the "days" could be made configurable
-typeset -a ZSH_PIP_INDEXES ZSH_PIP_XMLRPC_INDEXES
-
-# Enabling this would additionally use the simple PyPI index, which does not
-# support limiting by date.
-# ZSH_PIP_INDEXES=(https://pypi.python.org/simple/)
-
-# The XMLRPC index, which supports filtering by "last updated since".
-ZSH_PIP_XMLRPC_INDEXES=(https://pypi.python.org/pypi)
-# Using packages updated in the last year results in ~26798 packages currently.
-local ZSH_PIP_XMLRPC_INDEX_DAYS=365
-
-
-# Get all packages from (remote) indexes.
-_pip_all() {
- _pip_set_cache_policy
-
- if ( (( $+__zsh_pip_all_pkgs )) && ! _cache_invalid pip_allpkgs ) \
- || _retrieve_cache pip_allpkgs; then
- return
- fi
-
- typeset -a -g __zsh_pip_all_pkgs
- if zstyle -T ":completion:${curcontext}:" remote-access; then
- typeset -a new_zsh_all_pkgs
- local ts_xmlrpc_start
- if zmodload -F zsh/datetime +p:EPOCHSECONDS 2>/dev/null; then
- ts_xmlrpc_start=$((EPOCHSECONDS - (86400 * ZSH_PIP_XMLRPC_INDEX_DAYS)))
- else
- ts_xmlrpc_start=$(date +%s -d @$(($(date +%s) - (86400 * ZSH_PIP_XMLRPC_INDEX_DAYS))))
- fi
-
- # Build XMLPC request to pypi.python.org to get a list of packages updated
- # in the last year. This is meant to reduce the number of packages.
- local xml_req="<?xml version='1.0'?><methodCall><methodName>updated_releases</methodName><params><param><value><int>${ts_xmlrpc_start}</int></value></param></params></methodCall>"
-
- # TODO: Standard error is not redirected
- for xmlrpc_index in $ZSH_PIP_XMLRPC_INDEXES; do
- new_zsh_all_pkgs+=($(_call_program fetch-all-xml "echo ${(qqqq)xml_req} \
- | curl -s --max-time 30 -d @- -H \"Content-Type: text/xml\" $xmlrpc_index \
- | sed -n '/^<value><string>/p' | sed -n '1~2 s/^<value><string>//p' | sed -n 's/<\/string><\/value>$//p' \
- | tr '\n' ' '") )
- done
-
- for index in $ZSH_PIP_INDEXES; do
- # All packages, more than 54000!
- new_zsh_all_pkgs+=( $(curl -s --max-time 30 $index \
- | sed -n '/<a href/ s/.*>\([^<]\{1,\}\).*/\1/p' \
- | tr '\n' ' ') )
- done
-
- if [[ $new_zsh_all_pkgs ]]; then
- __zsh_pip_all_pkgs=($new_zsh_all_pkgs)
- _store_cache pip_allpkgs __zsh_pip_all_pkgs
- else
- _message "Could not update package cache."
- fi
- fi
-}
-
-# Get installed packages, using pips completion interface.
-_pip_installed() {
- installed_pkgs=($(_call_program fetch-installed \
- "env COMP_WORDS='pip uninstall' COMP_CWORD=2 PIP_AUTO_COMPLETE=1 $pip"))
-
- # TODO: using a cache might be benefical, but needs to cache by the "pip"
- # being used, which seems not to be worth it.
- # _pip_set_cache_policy
- #
- # if ( ! (( $+__zsh_pip_installed_pkgs )) || _cache_invalid pip_installedpkgs ) &&
- # ! _retrieve_cache pip_installedpkgs;
- # then
- # typeset -a -g __zsh_pip_installed_pkgs
- # # __zsh_pip_installed_pkgs=($($pip freeze | cut -d '=' -f 1))
- # __zsh_pip_installed_pkgs=($(_call_program fetch-installed \
- # "env COMP_WORDS='pip uninstall' COMP_CWORD=2 PIP_AUTO_COMPLETE=1 $pip"))
- # _store_cache pip_installedpkgs __zsh_pip_installed_pkgs
- # fi
-}
-
-_pip_set_cache_policy() {
- local cache_policy
- zstyle -s ":completion:${curcontext}:" cache-policy cache_policy
- if [[ -z "$cache_policy" ]]; then
- zstyle ":completion:${curcontext}:" cache-policy _pip_caching_policy
- fi
-}
-
-_pip_caching_policy() {
- if [[ ${1:t} == pip_allpkgs ]]; then
- # rebuild if cache is more than two weeks old
- local -a oldp
- oldp=( "$1"(Nm+14) )
- (( $#oldp ))
-
- else # pip_installedpkgs
- # Compare cache file's timestamp to the most recently modified sys.path entry.
- # This gets changed/touched when installing removing packages.
- local newest_sys_path=$($python -c '
-import sys
-from os.path import exists, getmtime
-print(sorted(sys.path, key=lambda x: exists(x) and getmtime(x))[-1])')
- [[ $newest_sys_path -nt $1 ]]
- fi
-}
-
-
-local -a common_ops
-common_ops=(
- '(* : -)'{-h,--help}"[show help]"
- \*{-v,--verbose}"[give more output]"
- {-V,--version}"[show version and exit]"
- {-q,--quiet}"[give less output]"
- "--log=[log file where a complete record will be kept]:file"
- "--proxy=[specify a proxy in the form user:passwd@proxy.server:port]:proxy"
- "--timeout=[set the socket timeout (default 15 seconds)]:second"
- "--exists-action=[default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup]:action"
- "--cert=[path to alternate CA bundle]:path"
-)
-
-_requirements_file () {
- # Prefer requirement* and *.txt pattern. This falls back to "all files",
- # according to the file-patterns style.
- _wanted files expl file _files -g 'requirement*(-.)' -g '*.txt(-.)' "$@" -
-}
-
-typeset -A opt_args
-local curcontext="$curcontext" state line ret=1
-curcontext="${curcontext%:*}-$words[2]:"
-
-_arguments -C \
- ':subcommand:->subcommand' \
- $common_ops \
- '*::options:->options' && ret=0
-
-case $state in
- subcommand)
- local -a subcommands
- subcommands=(
- "install:install packages"
- "uninstall:uninstall packages"
- "freeze:output installed packages in requirements format"
- "list:list installed packages"
- "show:show information about installed packages"
- "search:search PyPI for packages"
- "wheel:build wheels from your requirements"
- "help:show available commands"
-
- "zip:zip dividual packages"
- "unzip:unzip undividual packages"
- "bundle:create pybundle"
- )
-
- _describe -t subcommands 'pip subcommand' subcommands && ret=0
- ;;
-
- options)
- local -a args
- args=(
- $common_ops
- )
-
- local -a pi_ops
- pi_ops=(
- {-i,--index-url=}"[base URL of Python Package Index]:URL"
- "--extra-index-url=[extra URLs of package indexes to use in addition to --index-url]:URL"
- "--no-index[ignore package index (only looking at --find-links URLs instead)]"
- {-f,--find-links=}"[URL to look for packages at]:URL"
- {-M,--use-mirrors}"[use the PyPI mirrors as a fallback in case the main index is down]"
- "--mirrors=[specific mirror URLs to query when --use-mirrors is used]:URL"
- "--allow-external=[allow the installation of externally hosted files]:package"
- "--allow-all-external[allow the installation of all externally hosted files]"
- "--no-allow-external[disallow the installation of all externally hosted files]"
- "--allow-insecure=[allow the installation of insecure and unverifiable files]:package"
- "--no-allow-insecure[disallow the installation of insecure and unverifiable files]"
- )
-
- case $words[1] in
- install | bundle)
- args+=(
- {-e,--editable=}"[install a package directly from a checkout]:directory or VCS+REPOS_URL[@REV]#egg=PACKAGE:_files -/"
- {-r,--requirement=}"[install all the packages listed in the given requirements file]:requirements file:_requirements_file"
- {-b,--build=}"[unpack packages into DIR]:directory:_directories"
- {-t,--target=}"[install packages into DIR]:directory:_directories"
- {-d,--download=}"[download packages into DIR instead of installing them]:directory:_directories"
- "--download-cache=[cache downloaded packages in DIR]:directory:_directories"
- "--src=[check out --editable packages into DIR]:directory:_directories"
- {-U,--upgrade}"[upgrade all packages to the newest available version]"
- "--force-reinstall[when upgrading, reinstall all packages even if they are already up-to-date]"
- {-I,--ignore-installed}"[ignore the installed packages]"
- "--no-deps[don't install package dependencies]"
- "--no-install[download and unpack all packages, but don't actually install them]"
- "--no-download[don't download any packages, just install the ones already downloaded]"
- "--install-option=[extra arguments to be supplied to the setup.py install command]:options"
- "--global-option=[extra global options to be supplied to the setup.py call before the install command]:options"
- "--user[install using the user scheme]"
- "--egg[install as self contained egg file, like easy_install does]"
- "--root=[install everything relative to this alternate root directory]:directory:_directories"
- "--use-wheel[find and prefer wheel archives when searching indexes and find-links locations]"
- "--pre[include pre-release and development versions]"
- "--no-clean[don't clean up build directories]"
- ':package name:->pkgs_all_and_dirs'
-
- $pi_ops
- )
- ;;
-
- uninstall)
- args+=(
- {-r,--requirement=}"[install all the packages listed in the given requirements file]::requirements file:_requirements_file"
- {-y,--yes}"[don't ask for confirmation of uninstall deletions]"
- ':installed package:->pkgs_installed'
- )
- ;;
-
- freeze)
- args+=(
- {-r,--requirement=}"[install all the packages listed in the given requirements file]::requirements file:_requirements_file"
- {-f,--find-links=}"[URL to look for packages at]:URL"
- {-l,--local}"[If in a virtualenv that has global access, do not list globally-installed packages]"
- )
- ;;
-
- list)
- args+=(
- {-o,--outdated}"[list outdated packages (excluding editables)]"
- {-u,--uptodated}"[list uptodated packages (excluding editables)]"
- {-e,--editable}"[list editable projects]"
- {-l,--local}"[If in a virtualenv that has global access, do not list globally-installed packages]"
- "--pre[include pre-release and development versions]"
- $pi_ops
- )
- ;;
-
- show)
- args+=(
- {-f,--files}"[show the full list of installed files for each package]"
- ':installed package:->pkgs_installed'
- )
- ;;
-
- search)
- args+=(
- "--index[base URL of Python Package Index]:URL"
- )
- ;;
-
- wheel)
- args+=(
- {-w,--wheel-dir=}"[build wheels into DIR, where the default is '<cwd>/wheelhouse']:directory:_directories"
- "--use-wheel[find and prefer wheel archives when searching indexes and find-links locations]"
- "--build-option=[extra arguments to be supplied to 'setup.py bdist_wheel']:options"
- {-r,--requirement=}"[install all the packages listed in the given requirements file]::requirements file:_requirements_file"
- "--download-cache=[cache downloaded packages in DIR]:directory:_directories"
- "--no-deps[don't install package dependencies]"
- {-b,--build=}"[directory to unpack packages into and build in]:directory:_directories"
- "--global-option=[extra global options to be supplied to the setup.py call before the 'bdist_wheel' command]:options"
- "--pre[include pre-release and development versions]"
- "--no-clean[don't clean up build directories]"
- $pi_ops
- )
- ;;
-
- unzip | zip)
- args+=(
- "--unzip[unzip a package]"
- "--no-pyc[do not include .pyc files in zip files]"
- {-l,--list}"[list the packages available, and their zip status]"
- "--sort-files[with --list, sort packages according to how many files they contain]"
- "--path=[restrict operation to the given paths]:paths"
- {-n,--simulate}"[do not actually perform the zip/unzip operation]"
- )
- ;;
- esac
-
- _arguments $args && ret=0
-
- # Additional states for expensive actions.
- case $state in
- pkgs_all_and_dirs)
- _pip_all
- _wanted all-packages expl 'packages' compadd -a __zsh_pip_all_pkgs && ret=0
- # TODO: only let _files fallback to dirs? Use **/setup.py with _path_files and some limiting?
- _wanted directories expl 'directory with setup.py' _files -g '*/setup.py(:h/)' -s /setup.py && ret=0
- ;;
-
- pkgs_installed)
- local -a installed_pkgs
- _pip_installed
- _wanted installed-package expl 'installed packages' compadd -a installed_pkgs && ret=0
- ;;
- esac
- ;;
-esac
-
-return ret