* fma: added support for -h/--help + -v/--version
authorMichael Prokop <mika@grml.org>
Fri, 27 Oct 2006 23:00:34 +0000 (01:00 +0200)
committerMichael Prokop <mika@grml.org>
Fri, 27 Oct 2006 23:00:34 +0000 (01:00 +0200)
* wrote manpage for fma
* added lzop to Suggests

debian/changelog
debian/control
debian/rules
manpages/fma.1 [new file with mode: 0644]
usr_bin/fma

index 2e34a84..e6c7111 100644 (file)
@@ -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
index 07bb0e1..d5e2ca4 100644 (file)
@@ -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:
index a4c220a..4bc9053 100755 (executable)
@@ -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 (file)
index 0000000..6fc93c4
--- /dev/null
@@ -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 <requested_manpage>' 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 <mika@grml.org> based on an idea of
+Matthias Kopfermann <matthi@grml.org>.
+.PP
+This manual page was written by Michael Prokop <mika@grml.org>
+for the grml project (but may be used by others).
index b499747..9adb134 100755 (executable)
@@ -4,7 +4,7 @@
 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
 # 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
 
 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