From b9858f98a4847a183ec531afbf69c2c2194022a9 Mon Sep 17 00:00:00 2001 From: nowrep Date: Mon, 4 Mar 2013 13:23:04 +0100 Subject: [PATCH] Added basic bash and zsh autocompletion files. Bash autocompletion will be installed by default with make install. Zsh autocompletion has to be installed manually, more on that in linux/completion/README --- CHANGELOG | 1 + linux/completion/README | 8 ++++++++ linux/completion/bash_completion.sh | 17 +++++++++++++++++ linux/completion/zsh_completion.sh | 22 ++++++++++++++++++++++ src/install.pri | 5 +++++ src/lib/app/commandlineoptions.cpp | 4 ++-- 6 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 linux/completion/README create mode 100644 linux/completion/bash_completion.sh create mode 100644 linux/completion/zsh_completion.sh diff --git a/CHANGELOG b/CHANGELOG index fb8964549..3e0b5a16d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,7 @@ Version 1.4.0 * added support for FTP listing files and downloading * added support for saving passwords of multiple users per site * added support for showing tabs on top + * added bash autocompletion file * possibility to select text on page with Shift+Arrow keys * asking user whether to allow site to use notifications/geolocation * option to set JavaScript privacy permissions diff --git a/linux/completion/README b/linux/completion/README new file mode 100644 index 000000000..2f5e80fae --- /dev/null +++ b/linux/completion/README @@ -0,0 +1,8 @@ +Bash completion file will be automatically installed with make install +into /etc/bash_completion.d/ + +To install zsh completion file, either manually copy it to proper directory +(one directory from $fpath) and rename to _qupzilla, or run this +command: + +cp notes "`echo $fpath | cut -d' ' -f1`/_qupzilla" diff --git a/linux/completion/bash_completion.sh b/linux/completion/bash_completion.sh new file mode 100644 index 000000000..2337a3892 --- /dev/null +++ b/linux/completion/bash_completion.sh @@ -0,0 +1,17 @@ +_qupzilla() +{ + local cur prev opts + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + opts="-h --help -a --authors -v --version -p= --profile= + -ne --no-extensions -nt --new-tab -pb --private-browsing + -dm --download-manager -nr --no-remote -ct= --current-tab= + -ow= --open-window=" + + if [[ ${cur} == -* ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + fi +} +complete -F _qupzilla qupzilla diff --git a/linux/completion/zsh_completion.sh b/linux/completion/zsh_completion.sh new file mode 100644 index 000000000..11b292a1f --- /dev/null +++ b/linux/completion/zsh_completion.sh @@ -0,0 +1,22 @@ +#compdef qupzilla + +opts=( + '(-)'{-h,--help}'[print usage help]' + '(-)'{-a,--authors}'[print QupZilla authors]' + '(-)'{-v,--version}'[print QupZilla version]' + + '(-)'{-p=,--profile=}'[start with specified profile]' + '(-)'{-ne,--no-extensions}'[start without extensions]' + + '(-)'{-nt,--new-tab}'[open new tab]' + '(-)'{-nw,--new-window}'[open new window]' + '(-)'{-pb,--private-browsing}'[start private browsing]' + '(-)'{-dm,--download-manager}'[show download manager]' + '(-)'{-nr,--no-remote}'[open new instance]' + '(-)'{-ct=,--current-tab=}'[open URL in current tab]' + '(-)'{-ow=,--open-window=}'[open URL in new window]' + ) + +_x_arguments -C $opts + +return 0 diff --git a/src/install.pri b/src/install.pri index 2671aee8f..f9af52e85 100644 --- a/src/install.pri +++ b/src/install.pri @@ -41,6 +41,11 @@ mac { ico256.files = $$PWD/../linux/hicolor/256x256/apps/qupzilla.png ico256.path = $$hicolor_folder/256x256/apps + bashcompletion.files = $$PWD/../linux/completion/bash_completion.sh + bashcompletion.path = /etc/bash_completion.d/ + + INSTALLS += target target1 target2 target3 INSTALLS += ico16 ico32 ico48 ico64 ico128 ico256 + INSTALLS += bashcompletion } diff --git a/src/lib/app/commandlineoptions.cpp b/src/lib/app/commandlineoptions.cpp index c5384df33..364f3771f 100644 --- a/src/lib/app/commandlineoptions.cpp +++ b/src/lib/app/commandlineoptions.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2012 David Rosca +* Copyright (C) 2010-2013 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -86,7 +86,7 @@ void CommandLineOptions::parseActions() if (arg == QLatin1String("-a") || arg == QLatin1String("--authors")) { cout << "QupZilla authors: " << endl; - cout << " nowrep " << endl; + cout << " David Rosca " << endl; ActionPair pair; pair.action = Qz::CL_ExitAction; m_actions.append(pair);