generated from allemand-instable/LaTeX-Template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
log.zsh
40 lines (38 loc) · 930 Bytes
/
log.zsh
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
#!/bin/zsh
if (( $# == 0 )); then
echo "Usage: $0 [--error] [--warning] [--info] [--help]"
exit 0
fi
# Parse command line arguments
while (( $# )); do
case "$1" in
-e|--error)
pattern="\!"
batgrep --color -i -B 0 -A 12 "${pattern}" "aux_files/rapport.log"
shift
;;
-w|--warning)
# Replace with the command for --warning
echo "Warning"
pattern="Warning:"
batgrep --color -B 0 -A 12 "${pattern}" "aux_files/rapport.log"
shift
;;
-i|--info)
# Replace with the command for --info
echo "Info"
pattern="Info:"
batgrep --color -B 0 -A 12 "${pattern}" "aux_files/rapport.log"
shift
;;
-h|--help)
echo "Usage: $0 [--error] [--warning] [--info] [--help]"
exit 0
;;
*)
echo "Unknown argument: $1"
echo "Usage: $0 [--error] [--warning] [--info] [--help]"
exit 1
;;
esac
done