Skip to content
This repository was archived by the owner on Apr 25, 2024. It is now read-only.

Commit cc7d994

Browse files
committed
Add version flag
1 parent 5c87bb2 commit cc7d994

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

Makefile

+7-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ MANPREFIX ?= $(PREFIX)/share/man
77

88
MANPAGE = auto-inhibit.1
99

10-
all: $(MANPAGE)
10+
all: auto-inhibit $(MANPAGE)
11+
12+
auto-inhibit: auto-inhibit.in
13+
sed -e "s/VERSION=/VERSION=$(VERSION)/" auto-inhibit.in > auto-inhibit
14+
chmod +x auto-inhibit
1115

1216
$(MANPAGE): man/$(MANPAGE).pod
1317
pod2man -n=auto-inhibit -c=auto-inhibit -r=$(VERSION) $< $(MANPAGE)
@@ -26,9 +30,9 @@ uninstall:
2630
rm -f $(DESTDIR)$(MANPREFIX)/man1/auto-inhibit.1
2731

2832
clean:
29-
rm -f $(MANPAGE)
33+
rm -f auto-inhibit $(MANPAGE)
3034

31-
test:
35+
test: auto-inhibit
3236
$(MAKE) -C test
3337

3438
.PHONY: all install uninstall clean test

auto-inhibit auto-inhibit.in

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
set -eu
66

7+
readonly VERSION=
8+
79
readonly CONFIG="${AUTO_INHIBIT_CONF:-/etc/auto-inhibit.conf}"
810
readonly INHIBITOR="${AUTO_INHIBITOR:-$(command -v auto-inhibit)}"
911

@@ -64,6 +66,7 @@ usage() {
6466
options:
6567
-h Show help message
6668
-d DIR Operate on DIR
69+
-v Show version
6770
6871
commands:
6972
list List symlinks
@@ -85,10 +88,11 @@ status() {
8588
exit $?
8689
}
8790

88-
while getopts ':hd:' opt; do
91+
while getopts ':hd:v' opt; do
8992
case "$opt" in
9093
h) usage; exit ;;
9194
d) symdir="$OPTARG" ;;
95+
v) echo "$VERSION"; exit ;;
9296
*) usage >&2; exit 2
9397
esac
9498
done

man/auto-inhibit.1.pod

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ Show help message.
2323

2424
Operate on I<DIRECTORY>.
2525

26+
=item B<-v>
27+
28+
Show version.
29+
2630
=back
2731

2832
=head1 COMMANDS

0 commit comments

Comments
 (0)