summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2016-10-11 14:50:04 +0200
committerErich Eckner <git@eckner.net>2016-10-11 14:50:04 +0200
commit5dfad9ce9c93fac864a58be3ae87008b55149e5b (patch)
treec02ffc8cb7805e0602015f70e388d29321d86fdd
parent309bed54dc3ccff762d966b80e7bebc0f4c25a3f (diff)
downloadsound-cutter-5dfad9ce9c93fac864a58be3ae87008b55149e5b.tar.xz
manpage automatisch erstellen
-rw-r--r--.gitignore4
-rw-r--r--Makefile14
-rw-r--r--man.commons.in (renamed from sound-cutter.1.in)41
-rw-r--r--sound-cutter.in40
4 files changed, 35 insertions, 64 deletions
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/sound-cutter.1.in b/man.commons.in
index ed63a0f..2ac48ca 100644
--- a/sound-cutter.1.in
+++ b/man.commons.in
@@ -1,41 +1,4 @@
-.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
+[POINTS_FILE]
Structure of file containing instructions for mixing, processing and cutting:
.TP
.B "# with trailing space"
@@ -57,7 +20,7 @@ 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
+[AUTHOR]
.nf
Erich Eckner <opensource at eckner dot net>
.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