[irstlm] 05/146: Added irstlm wrapper script.

Giulio Paci giuliopaci-guest at moszumanska.debian.org
Tue May 17 07:37:01 UTC 2016


This is an automated email from the git hooks/post-receive script.

giuliopaci-guest pushed a commit to branch master
in repository irstlm.

commit 0aae114ed40293f79d49df4fbd0b569a61f321a5
Author: Giulio Paci <giuliopaci at gmail.com>
Date:   Tue May 1 00:51:51 2012 +0200

    Added irstlm wrapper script.
---
 debian/irstlm.install          |   2 +-
 debian/manpages                |   1 +
 debian/manpages_files/irstlm.1 |  37 ++++++++++++
 debian/scripts/irstlm          | 133 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 172 insertions(+), 1 deletion(-)

diff --git a/debian/irstlm.install b/debian/irstlm.install
index d1e4dc3..9f2facd 100644
--- a/debian/irstlm.install
+++ b/debian/irstlm.install
@@ -1,2 +1,2 @@
 debian/tmp/usr/bin/* usr/lib/irstlm/bin/
-
+debian/scripts/irstlm usr/bin/
diff --git a/debian/manpages b/debian/manpages
index 8b13789..14d4574 100644
--- a/debian/manpages
+++ b/debian/manpages
@@ -1 +1,2 @@
+debian/manpages_files/*.1
 
diff --git a/debian/manpages_files/irstlm.1 b/debian/manpages_files/irstlm.1
new file mode 100644
index 0000000..d004be2
--- /dev/null
+++ b/debian/manpages_files/irstlm.1
@@ -0,0 +1,37 @@
+.TH irstlm 1 March,\ 2012
+
+.SH NAME
+irstlm - IRST Language Modeling toolkit
+ 
+.SH SYNOPSIS
+
+\fBirstlm\fR [command [options]]
+
+\fBirstlm\fR help [command]
+
+.SH DESCRIPTION
+
+\fBirstlm\fR is a frontend to the IRST Language Modeling toolkit (IRSTLM), a suite of tools to create and manipulate language models.
+
+.SH OPTIONS
+
+.TP
+irstlm \fBhelp\fR
+Print a brief descriprion of the available commands.
+
+.TP
+irstlm \fBhelp\fR \fIcommand\fR
+Print help for \fIcommand\fR, providing a brief description and a list of the command's options.
+
+.TP
+irstlm \fBcommand\fR [\fIoptions\fR]
+Executes \fBcommand\fR with the given \fIoptions\fR. 
+
+.SH NOTES
+
+The \fBirstlm\fR command is a front-end to the IRSTLM toolkit and has been developed for Debian. For more information, or to provide BUG reports, contact the maintainer of the Debian irstlm package.
+
+For more information related to the IRSTLM toolkit, please refer to http://sourceforge.net/projects/irstlm/.
+
+The IRSTLM commands are available in \fI/usr/lib/irstlm/bin/\fR. If you prefer direct access to them, consider adding this directory to your PATH. Most of those commands requires the environment variable For direct access to most of the IRSTLM commands you will also need to set the IRSTLM environment variable to \fI/usr/lib/irstlm\fR.
+
diff --git a/debian/scripts/irstlm b/debian/scripts/irstlm
new file mode 100755
index 0000000..0111b5e
--- /dev/null
+++ b/debian/scripts/irstlm
@@ -0,0 +1,133 @@
+#!/bin/bash
+
+# This software is released according to the Expat license below.
+#
+# Copyright: 2012, Giulio Paci <giuliopaci at gmail.com>
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation
+# files (the "Software"), to deal in the Software without
+# restriction, including without limitation the rights to use, copy,
+# modify, merge, publish, distribute, sublicense, and/or sell copies
+# of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+ 
+
+
+COMMAND="$1"
+
+export IRSTLM=/usr/lib/irstlm
+IRSTLM_PATH=/usr/lib/irstlm/bin
+PATH=$IRSTLM_PATH:$PATH
+
+function get_commands()
+{
+    ls "$IRSTLM_PATH" | while read cmnd;
+    do
+	"$IRSTLM_PATH"/"$cmnd" -h 2>&1 \
+	    | head -n 3 \
+	    | grep  . \
+	    ;
+    done
+    echo "help - print help about commands"
+}
+
+function get_help_usage()
+{
+    local cmnd="$1"
+    if [[ "$cmnd" == "" ]]
+    then
+    cat<<EOF
+
+help - print help about commands
+
+USAGE:
+       help [ command ]
+
+COMMANDS:
+EOF
+	get_commands | sed -e 's/^/       /' | sed -e 's/[.]\(sh\|pl\) -/ -/g'
+    cat<<EOF
+
+EOF
+    else
+	if [ -x "$IRSTLM_PATH"/"$cmnd" ]
+	then
+	    "$IRSTLM_PATH"/"$cmnd" -h 2>&1
+	elif [ -x "$IRSTLM_PATH"/"$cmnd".sh ]
+	then
+	    "$IRSTLM_PATH"/"$cmnd".sh -h 2>&1 | sed -e 's/\('"$cmnd"'\)[.]sh/\1/g'
+	elif [ -x "$IRSTLM_PATH"/"$cmnd".pl ]
+	then
+	    "$IRSTLM_PATH"/"$cmnd".pl -h 2>&1 | sed -e 's/\('"$cmnd"'\)[.]pl/\1/g'
+	else
+	    cat<<EOF
+"$cmnd" command unsupported.
+Try "$0 help" for a list of supported commands.
+EOF
+	fi
+    fi
+}
+
+function get_usage()
+{
+    local cmnd="$1"
+    if [[ "$cmnd" == "" ]]
+    then
+	cat<<EOF
+
+irstlm - frontend to the IRSTLM toolkit
+
+USAGE:
+       irstlm [ command ] [ command_options ]
+       irstlm help [ command ]
+
+EXAMPLES:
+       irstlm help
+          Print a brief descriprion of the available
+          commands.
+       irstlm help <command>
+          Print help for <command>.
+       irstlm <command> [ command_options ]
+          Executes <command> with the given options. 
+
+EOF
+    fi
+}
+
+if [[ "$1" == "" ]]
+then
+    get_usage
+    exit
+fi
+shift
+if [[ "$COMMAND" == "help" ]]
+then
+    get_help_usage "$1"
+    exit 0;
+fi
+
+if [ -x "$IRSTLM_PATH"/"$COMMAND" ]
+then
+    "$IRSTLM_PATH"/"$COMMAND" "$@"
+elif [ -x "$IRSTLM_PATH"/"$COMMAND".sh ]
+then
+    "$IRSTLM_PATH"/"$COMMAND".sh "$@"
+elif [ -x "$IRSTLM_PATH"/"$COMMAND".pl ]
+then
+    "$IRSTLM_PATH"/"$COMMAND".pl "$@"
+else
+    get_help_usage "$COMMAND"
+fi

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/irstlm.git



More information about the debian-science-commits mailing list