Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1972, Add zsh completion script #2031

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ AC_ARG_WITH([bashcompletiondir],
[Directory to install bash_completion file]),
[bashcompletiondir=$withval], [bashcompletiondir=$docdir/bash_completion])

AC_ARG_WITH([zshcompletiondir],
AS_HELP_STRING([--with-zshcompletiondir=DIR],
[Directory to install zsh_completion file]),
[zshcompletiondir=$withval], [zshcompletiondir=$docdir/zsh_completion])

AC_ARG_VAR([ARIA2_STATIC], [Set 'yes' to build a statically linked aria2])

AC_ARG_ENABLE([gnutls-system-crypto-policy],
Expand Down Expand Up @@ -1127,5 +1132,6 @@ Message Digest: $use_md
WebSocket: $enable_websocket (CFLAGS='$WSLAY_CFLAGS' LIBS='$WSLAY_LIBS')
Libaria2: $enable_libaria2 (shared=${enable_shared} static=${enable_static})
bash_completion dir: $bashcompletiondir
zsh_completion dir: $zshcompletiondir
Static build: $ARIA2_STATIC
])
3 changes: 3 additions & 0 deletions doc/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ dist_doc_bashcompletion_DATA = bash_completion/README.txt

doc_bashcompletionscriptdir = @bashcompletiondir@
dist_doc_bashcompletionscript_DATA = bash_completion/aria2c

doc_zshcompletionscriptdir = @zshcompletiondir@
dist_doc_zshcompletionscript_DATA = zsh_completion/aria2c
42 changes: 42 additions & 0 deletions doc/zsh_completion/_aria2c
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#compdef aria2c
_aria2c_files_stdout() {
_alternative 'stdout:stdout:((-\:stdout))' 'files:file:_files'
}

local options=(
'(- : *)'{-v,--version}"[Print the version number and exit]"
'(- : *)'{-h,--help}"[Print usage and exit]:TAG or KEYWORD:(#basic #advanced #http #https #ftp #metalink #bittorrent #cookie #hook #file #rpc #checksum #experimental #deprecated #help #all)"
{-l,--log}"[The file name of the log file]:LOG:_aria2c_files_stdout"
{-d,--dir}"[The directory to store the downloaded file]:DIR:_dirs"
{-o,--out}"[The file name of the downloaded file]:FILE:_files"
{-s,--split}"[Download a file using N connections]:N"
--file-allocation"[Specify file allocation method]:METHOD:(none prealloc trunc falloc)"
{-V,--check-integrity}"[Check file integrity by validating piece]:bool:(true false)"
{-c,--continue}"[Continue downloading a partially downloaded]:bool:(true false)"
{-i,--input-file}"[Downloads URIs found in FILE]:FILE:_aria2c_files_stdout"
{-j,--max-concurrent-downloads}"[Set maximum number of parallel downloads for every static (HTTP/FTP) URL, torrent and metalink]:N"
{-Z,--force-sequential}"[Fetch URIs in the command-line sequentially]:bool:(true false)"
{-x,--max-connection-per-server}"[The maximum number of connections to one server for each download]:NUM"
{-k,--min-split-size}"[aria2 does not split less than 2*SIZE byte range]:SIZE"
--ftp-user"[Set FTP user. This affects all URLs]:USER:_users"
--ftp-passwd"[Set FTP password. This affects all URLs]:PASSWD"
--http-user"[Set HTTP user. This affects all URLs]:USER:_users"
--http-passwd"[Set HTTP password. This affects all URLs]:PASSWD"
--load-cookies"[Load Cookies from FILE using the Firefox3 format and Mozilla/Firefox(1.x/2.x)/Netscape format]:FILE:_files"
'(- : *)'{-S,--show-files}"[Print file listing of .torrent, .meta4 and .metalink file and exit]:bool:(true false)"
--max-overall-upload-limit"[Set max overall upload speed in bytes/sec, 0 means unrestricted]:SPEED"
{-u,--max-upload-limit}"[Set max upload speed per each torrent in bytes/sec, 0 means unrestricted]:SPEED"
{-T,--torrent-file}"[The path to the .torrent file]:TORRENT_FILE:_files"
--listen-port"[Set TCP port number for BitTorrent downloads]:PORT"
--enable-dht"[Enable IPv4 DHT functionality. It also enables]:bool:(true false)"
--dht-listen-port"[Set UDP listening port used by DHT(IPv4, IPv6)]:PORT"
--enable-dht6"[Enable IPv6 DHT functionality]:bool:(true false)"
--dht-listen-addr6"[Specify address to bind socket for IPv6 DHT]:ADDR"
{-M,--metalink-file}"[The file path to the .meta4 and .metalink file]:METALINK_FILE:_aria2c_files_stdout"
--enable-rpc
--rpc-secret"[a combination of --rpc-user and --rpc-passwd]:secret:_users"
--rpc-user"[Set rpc user. This affects all URLs]:USER:_users"
--rpc-passwd"[Set rpc password. This affects all URLs]:PASSWD"
)

_arguments -S -s $options "*::URI | MAGNET | TORRENT_FILE | METALINK_FILE:{_alternative urls:url:_urls files:file:_files}"