From 1e39a7bd1b6e8f8bbb15b2b1aefaa0a91e4bb7dc Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Sat, 28 Oct 2006 01:00:34 +0200 Subject: [PATCH] * fma: added support for -h/--help + -v/--version * wrote manpage for fma * added lzop to Suggests --- debian/changelog | 2 +- debian/control | 2 +- debian/rules | 2 +- manpages/fma.1 | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ usr_bin/fma | 20 ++++++++++++++++---- 5 files changed, 71 insertions(+), 7 deletions(-) create mode 100644 manpages/fma.1 diff --git a/debian/changelog b/debian/changelog index 2e34a84..e6c7111 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,7 +3,7 @@ grml-scripts (0.8-26) unstable; urgency=low * Split out network related scripts into package grml-network, depend on it therefore. * Added script fma (fast manual access, thanks for the idea - - wuehlmaus!) + wuehlmaus!), added lzop to Suggests. * Another cleanup of debian/rules. * Updated debian/overrides. * Added XS-X-Vcs-Hg: header to debian/control, see diff --git a/debian/control b/debian/control index 07bb0e1..d5e2ca4 100644 --- a/debian/control +++ b/debian/control @@ -9,7 +9,7 @@ XS-X-Vcs-Hg: http://hg.grml.org/grml-scripts Package: grml-scripts Architecture: any Depends: dialog, perl, zsh, dash, w3m | links | links2, screen, console-tools | xbase-clients, grml-network -Suggests: ruby, python, grml-x, ipcalc, hwinfo, antiword, grml-etc, grml-rebuildfstab, grml-scanpartitions, grml-files, grml-hwinfo, grml-saveconfig, pptp-linux, flite, wmii, mutt | mutt-ng, slrn, grml-docs, grml-autoconfig (>= 0.5-10) +Suggests: ruby, python, grml-x, ipcalc, hwinfo, antiword, grml-etc, grml-rebuildfstab, grml-scanpartitions, grml-files, grml-hwinfo, grml-saveconfig, pptp-linux, flite, wmii, mutt | mutt-ng, slrn, grml-docs, grml-autoconfig (>= 0.5-10), lzop Conflicts: scanmodem, grml-etc-core (<< 0.1-6) Description: some small scripts which should make life easier Some scripts which should make life easier. For example: diff --git a/debian/rules b/debian/rules index a4c220a..4bc9053 100755 --- a/debian/rules +++ b/debian/rules @@ -55,7 +55,7 @@ binary-arch: build install dh_installchangelogs dh_installdocs dh_installman manpages/grml-scripts.1 manpages/grml-bind.8 manpages/reread_partition_table.8 manpages/gtf.1 manpages/random-hostname.1 \ - manpages/grml-setkeyboard.8 manpages/grml-setlang.8 manpages/getsf.1 manpages/grml-iptstate.8 + manpages/grml-setkeyboard.8 manpages/grml-setlang.8 manpages/getsf.1 manpages/grml-iptstate.8 manpages/fma.1 # cp --no-dereference man/*.1.gz debian/grml-scripts/usr/share/man/man1/ dh_link /usr/sbin/blacklist /usr/sbin/unblacklist dh_link /usr/share/man/man1/grml-scripts.1.gz /usr/share/man/man1/align.1.gz diff --git a/manpages/fma.1 b/manpages/fma.1 new file mode 100644 index 0000000..6fc93c4 --- /dev/null +++ b/manpages/fma.1 @@ -0,0 +1,52 @@ +.TH FMA 1 +.SH NAME +fma \- fast manual access +.SH SYNOPSIS +.B fma +.RI [ section ] " manualpage" +.SH DESCRIPTION +This manual page documents briefly the +.B fma +command. +.PP +\fBfma\fP is a script which allows fast and efficient access to manual pages +through using compression via lzop and display of vim. + +fma generates manpages via running 'man ' and storing +the result in a file with the extension txt in directory $HOME/man. Then +lzop is executed for the file and the output is written to a file with the +additional extension lzo. Afterwards the editor vim is executed with +filetype set to man and using on-the-fly decompressing using lzop again. + +So far you did not win any time of course. But if you want to display the +same manpage again the processed manpage already exists in $HOME/man and +can be displayed immediately. If you want to experience the difference +just run 'fma zshall' two times and compare it with 'man zshall' too. +.SH OPTIONS +fma supports the following options: +.TP +.B \-h, \-\-help +Show summary of options. +.TP +.B \-v, \-\-version +Show version of program. +.TP +.B $MANDIR +If the environment variable MANDIR is set the specified directory is taken +for output files instead of the default directory $HOME/man. +.SH USAGE EXAMPLE +.TP +.B % fma zshall +Display manpage zshall (man zshall). +.TP +.B % fma 1 read +Display manpage read of section 1 (man 1 read). +.TP +.B % fma 2 read +Display manpage read of section 2 (man 2 read). +.SH AUTHOR +fma was written by Michael Prokop based on an idea of +Matthias Kopfermann . +.PP +This manual page was written by Michael Prokop +for the grml project (but may be used by others). diff --git a/usr_bin/fma b/usr_bin/fma index b499747..9adb134 100755 --- a/usr_bin/fma +++ b/usr_bin/fma @@ -4,7 +4,7 @@ # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. -# Latest change: Sam Okt 28 00:32:10 CEST 2006 [mika] +# Latest change: Sam Okt 28 00:50:16 CEST 2006 [mika] ################################################################################ . /etc/grml/lsb-functions @@ -12,14 +12,27 @@ check4progs man lzop vim || exit 1 -MANDIR=$HOME/man +MANDIR=${MANDIR:-$HOME/man} +VERSION='0.1' if ! [ -d "$MANDIR" ] ; then einfo "Creating $MANDIR." mkdir $MANDIR ; eend $? fi +usage() { + eerror "Usage: $0 [section] manpage" ; eend 1 + exit 1 +} + case $1 in + -h*|--h*) + usage + ;; + -v*|--v*) + einfo "$0 - version $VERSION" ; eend 0 + exit 0 + ;; [0-9]) SECTION="${1}" SECTIONFILE=".${1}" @@ -32,8 +45,7 @@ case $1 in esac if [ -z "$MANPAGE" ] ; then - eerror "Usage: $0 [section] manpage" ; eend 1 - exit 1 + usage fi if ! [ -f "${MANDIR}/${MANPAGE}${SECTIONFILE}.txt.lzo" ] ; then -- 2.1.4