-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathman2pdf.sh
59 lines (46 loc) · 974 Bytes
/
man2pdf.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# _ _ ___
# | || | __| H
# | __ | _| A
# |_||_|___| P
#
# ascii art made by figlet
#!/bin/sh
set -e
## global comment section {{{
#man -k . | dmenu -l 30 | awk '{print $1}' | xargs -r man -Tpdf | zathura -
#man -k . | dmenu -l 30 | awk '{print $1}' | xargs -r man -Tpdf > man_pacman.pdf
## }}}
NAme="$2"
OPtion="$1"
echo $NAme
# help function {{{
help ()
{
echo "
build a PDF document from a man page
Useage:
./man2pdf.sh [OPTION..] [NAME]
save, s, -s save PDF document on the Desktop
print, p, -p just show the document in zathura, do not save it as PDF
help, h, -h show this message
written by HE
github.com/primejade
"
}
# }}}
# case statement {{{
case $1 in
-[pP]|[pP]|[pP][rR][iI][nN][tT])
man -Tpdf $NAme | zathura -
;;
-[sS]|[sS]|[sS][aA][vV][eE])
man -Tpdf $NAme > ~/Desktop/$NAme.pdf
;;
-[hH]|[hH]|[hH][eE][lL][pP])
help
;;
*)
help
;;
esac
# }}}