From 5dfad9ce9c93fac864a58be3ae87008b55149e5b Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 11 Oct 2016 14:50:04 +0200 Subject: manpage automatisch erstellen --- .gitignore | 4 +++- Makefile | 14 ++++++++++--- man.commons.in | 26 +++++++++++++++++++++++ sound-cutter.1.in | 63 ------------------------------------------------------- sound-cutter.in | 40 +++++++++++++++++------------------ 5 files changed, 59 insertions(+), 88 deletions(-) create mode 100644 man.commons.in delete mode 100644 sound-cutter.1.in diff --git a/.gitignore b/.gitignore index dd66928..9d1500c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ sound-cutter -sound-cutter.1 +man.commons +*.common +*.1 diff --git a/Makefile b/Makefile index 4a231d2..6392938 100644 --- a/Makefile +++ b/Makefile @@ -25,12 +25,20 @@ MANDIR = /usr/share/man VERSION = 1.0.7 -all: sound-cutter sound-cutter.1 +all: man.commons sound-cutter sound-cutter.1 %: %.in - sed "s/#VERSION#/$(VERSION)/; s@#BINDIR#@$(BINDIR)@" $< > $@ + sed " \ + s/#VERSION#/$(VERSION)/; \ + s@#BINDIR#@$(BINDIR)@; \ + s@#HELPTEXT#\(\s\+\)#@ --help \1display this help and exit\n --version\1display version and exit@; \ + " $< > $@ [ "$@" = "sound-cutter" ] && chmod +x "$@" || true +%.1: % man.commons + grep -v "^$<(" man.commons | sed '/^\[SEE ALSO]$$/{n;:a;N;/\[/b;s/\n/, /;ta;}' > "$<.common" && \ + help2man -o "$@" -N --include $<.common --no-discard-stderr "./$<" + .PHONY: install dist clean install: all @@ -38,7 +46,7 @@ install: all install -D -m0644 sound-cutter.1 $(DESTDIR)$(MANDIR)/man1/sound-cutter.1 clean: - rm -f sound-cutter sound-cutter.1 + git clean -x -d -f dist: clean git status --porcelain 2> /dev/null | grep -q "\S" && (git add .; git commit -m"neue Version: $(VERSION)") || true diff --git a/man.commons.in b/man.commons.in new file mode 100644 index 0000000..2ac48ca --- /dev/null +++ b/man.commons.in @@ -0,0 +1,26 @@ +[POINTS_FILE] +Structure of file containing instructions for mixing, processing and cutting: +.TP +.B "# with trailing space" +starts comment (until end of line) +.TP +.B "# without trailing space" +divides left and right part of line +.TP +.B "first line" +left part denotes global start and stop of recording, +right part denotes final remix command +.TP +.B "other lines with non-empty left part" +denote border between tracks. Left part is time for cut, right part may be \fBoverlap $someTime\fP to denote fade betweeen tracks and/or \fBnoNewFile\fP to denote that no new +track should start here (thus it's only a border between \fBsub\fPtracks) or may be left empty. +.TP +.B "other lines with empty left part" +denote modifications of current (sub)track. +Additional to all sox effects, \fBtrimsplice $position $discard $excess $leeway\fP is also valid. +This combines splice and trim in a sensible manner. +These type of lines must not occure successively. +[AUTHOR] +.nf +Erich Eckner +.fi diff --git a/sound-cutter.1.in b/sound-cutter.1.in deleted file mode 100644 index ed63a0f..0000000 --- a/sound-cutter.1.in +++ /dev/null @@ -1,63 +0,0 @@ -.TH sound-cutter 1 "" "sound-cutter #VERSION#" "" -.SH NAME -sound-cutter \- Wrapper for sox for mastering stereo music (a.k.a. CDs) from multi channel records -.SH SYNOPSIS -\fBsound-cutter [options]\fP -.SH DESCRIPTION -\fBsound-cutter\fP mixes, processes and cuts multi channel recordings via \fBsox\fP. -.SH OPTIONS -.TP -.B "\-1, \-\-no\-gain" -Do not normalize audio (it's faster). -.TP -.B "\-f, \-\-force" -Overwrite output file(s). -.TP -.B "\-n, \-\-dummy" -Only print what would be done. -.TP -.B "\-s, \-\-sampleRate" -Explicitly set output sample rate. -.TP -.B "\-i, \-\-input" -Specify input file, one at a time (can be given multiple times). -.TP -.B "\-o, \-\-output" -Specify output file. -May be given only once. -.TP -.B "\-p, \-\-points" -Specify points file (see below for syntax). -May be given only once. -.TP -.B "\-a, \-\-ausfuehrlich" -Give verbose explanations (rudimentary). -.TP -.B "\-h, \-\-help" -Print help and exit. -.SH POINTS_FILE -Structure of file containing instructions for mixing, processing and cutting: -.TP -.B "# with trailing space" -starts comment (until end of line) -.TP -.B "# without trailing space" -divides left and right part of line -.TP -.B "first line" -left part denotes global start and stop of recording, -right part denotes final remix command -.TP -.B "other lines with non-empty left part" -denote border between tracks. Left part is time for cut, right part may be \fBoverlap $someTime\fP to denote fade betweeen tracks and/or \fBnoNewFile\fP to denote that no new -track should start here (thus it's only a border between \fBsub\fPtracks) or may be left empty. -.TP -.B "other lines with empty left part" -denote modifications of current (sub)track. -Additional to all sox effects, \fBtrimsplice $position $discard $excess $leeway\fP is also valid. -This combines splice and trim in a sensible manner. -These type of lines must not occure successively. -.SH AUTHOR -.nf -Erich Eckner -.fi diff --git a/sound-cutter.in b/sound-cutter.in index 33aaafc..fef9d72 100644 --- a/sound-cutter.in +++ b/sound-cutter.in @@ -3,26 +3,19 @@ set -e verwendung() { - >&2 echo 'Dies ist sound-cutter Version #VERSION#' - >&2 echo '' - >&2 echo 'Verwendung:' - >&2 echo '' - >&2 echo "${me}"' [ -1 | --noGain ] [ -a | --ausfuehrlich ] [ -c | --cd ] [ -f | --force ] { ( -i | --input ) input$i.flac } [ -n | --dummy ] ( -o | --output ) output.(flac|wav|mp3) ( -p | --points ) points [ ( -s | --sampleRate ) Rate ]' - >&2 echo '' - >&2 echo ' Mischen und Schneiden:' - >&2 echo ' -1 | --noGain: Lautstärke nicht normalisieren' - >&2 echo ' -a | --ausfuehrlich: ausführliche Zwischenausgaben machen' - >&2 echo ' -c | --cd: Dateien passend für CD-Tracks erzeugen' - >&2 echo ' -f | --force: output.flac ggf. überschreiben' - >&2 echo ' -i | --input: Quelle' - >&2 echo ' -n | --dummy: nur auszuführenden Befehl anzeigen und nichts tun' - >&2 echo ' -o | --output: Ziel' - >&2 echo ' -p | --points: Punktedatei' - >&2 echo ' -s | --sampleRate: alternative Samplerate zum Abspeichern' - >&2 echo '' - >&2 echo "$0"' [ -h | --help ]' - >&2 echo ' Hilfe anzeigen' + >&2 echo 'Verwendung: '"$(basename "${me}")"' [OPTIONEN]' >&2 echo '' + >&2 echo ' -1, --noGain Lautstärke nicht normalisieren' + >&2 echo ' -a, --ausfuehrlich ausführliche Zwischenausgaben machen' + >&2 echo ' -c, --cd Dateien passend für CD-Tracks erzeugen' + >&2 echo ' -f, --force output.flac ggf. überschreiben' + >&2 echo ' -i, --input=inputDatei Quelle' + >&2 echo ' -n, --dummy nur auszuführenden Befehl anzeigen und nichts tun' + >&2 echo ' -o, --output=outputDatei Zieldatei' + >&2 echo ' -p, --points=pointsDatei Punktedatei' + >&2 echo ' -s, --sampleRate=Rate alternative Samplerate zum Abspeichern' + >&2 echo \ +'#HELPTEXT# #' [ -z "$1" ] && exit 1 || exit $1 } @@ -45,7 +38,7 @@ timetosample() { me="$(readlink -f "$0")" eval set -- "$( - getopt -o 1acfhi:no:p:s: \ + getopt -o 1acfi:no:p:s: \ --long noGain \ --long ausfuehrlich \ --long cd \ @@ -56,6 +49,7 @@ eval set -- "$( --long output: \ --long points: \ --long sampleRate: \ + --long version \ -n "$(basename "$0")" -- "$@" || \ echo verwendung )" @@ -82,7 +76,7 @@ while true; do -f|--force) force=true ;; - -h|--help) + --help) verwendung 0 ;; -i|--input) @@ -107,6 +101,10 @@ while true; do [ -n "${outRate}" ] && echo 'Ich kann nur eine Samplerate-Option verstehen.' && verwendung outRate="$1" ;; + --version) + >&2 echo '#VERSION#' + exit 0 + ;; --) shift [ $# -gt 0 ] && echo 'Unbekannte Parameter: '"$#" && verwendung -- cgit v1.2.3-54-g00ecf