[Commits] [SCM] claws branch, master, updated. 3.15.0-45-g0e82e53

mones at claws-mail.org mones at claws-mail.org
Wed May 3 13:04:09 CEST 2017


The branch, master has been updated
       via  0e82e53cee31179a6394456fc8973c1eb6ffdf8f (commit)
      from  43a5970e1f7b623fb3641d7e384fb07ba2a8d4d4 (commit)

Summary of changes:
 tools/bash_completion/README     |   42 ++++++++++++++++++++++++++++++++++++++
 tools/bash_completion/claws-mail |   30 +++++++++++++++++++++++++++
 2 files changed, 72 insertions(+)
 create mode 100644 tools/bash_completion/README
 create mode 100644 tools/bash_completion/claws-mail


- Log -----------------------------------------------------------------
commit 0e82e53cee31179a6394456fc8973c1eb6ffdf8f
Author: Ricardo Mones <ricardo at mones.org>
Date:   Wed May 3 13:03:57 2017 +0200

    Add a simple bash completion helper

diff --git a/tools/bash_completion/README b/tools/bash_completion/README
new file mode 100644
index 0000000..4693ed8
--- /dev/null
+++ b/tools/bash_completion/README
@@ -0,0 +1,42 @@
+Bash Programmable Completion for Claws Mail
+-------------------------------------------
+
+This directory contains a script which provides argument completion
+when using Claws Mail from the command line under the bash shell.
+This is usually triggered by pressing the tab key (↹).
+
+See bash manual (https://www.gnu.org/software/bash/manual/) for more
+details about programmable completion.
+
+Usage
+-----
+
+Examples below assume current directory is the toplevel directory of
+either an extracted tarball or a git clone.
+
+Single user
+----------
+
+For a single user just make a directory (e.g. '.bash_completion.d')
+on your $HOME directory and copy the completion script there:
+
+$ mkdir ~/.bash_completion.d
+$ cp tools/bash_completion/claws-mail ~/.bash_completion.d/
+
+Then, source the script to enable it:
+
+$ . ~/.bash_completion.d/claws-mail
+
+To enable it permanently just add the command to the user's bashrc:
+
+$ echo '. ~/.bash_completion.d/claws-mail' >> $HOME/.bashrc
+
+All users
+---------
+
+For system wide installation just copy the file to the system directory,
+which is usually located in /etc (you need to become root for that):
+
+$ sudo cp tools/bash_completion/claws-mail /etc/bash_completion.d/
+
+After login in again all users should be able to use completion.
diff --git a/tools/bash_completion/claws-mail b/tools/bash_completion/claws-mail
new file mode 100644
index 0000000..dcbcc89
--- /dev/null
+++ b/tools/bash_completion/claws-mail
@@ -0,0 +1,30 @@
+# claws-mail(1) completion
+_claws-mail()
+{
+	local cur prev words cword
+	_init_completion || return
+
+	case $prev in
+	--help|-h|--version|-v|--version-full|-V)
+		return
+		;;
+	--alternate-config-dir)
+		COMPREPLY=( $( find . -maxdepth 2 -name clawsrc | sed 's,/clawsrc,,' ) )
+		return
+		;;
+	--select|--status|--status-full)
+		_filedir -d
+		return
+		;;
+	--compose-from-file|--attach)
+		_filedir
+		return
+		;;
+	esac
+
+	if [[ $cur == -* ]]; then
+		COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+		return
+	fi
+} &&
+complete -F _claws-mail claws-mail

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list