Browse Source

Add saturnin-yell for sending severe messages

Wrapper around three main functions from pretty.sh.  Useful to
demonstrate modularity of pretty.sh, eg:

    PRETTY=color saturnin-yell warn "you're doing it wrong"

will print the warning colored in the terminal, but

    PRETTY=color saturnin-yell warn "stop right now"

will send a desktop notification instead.
Alois Mahdal 6 years ago
parent
commit
385e1ba4c6
4 changed files with 29 additions and 0 deletions
  1. 1
    0
      mkit.ini
  2. 1
    0
      packaging/debian/saturnin-demo.install
  3. 1
    0
      packaging/template.spec
  4. 26
    0
      src/libexec/saturnin-demo-yell

+ 1
- 0
mkit.ini View File

62
     libexec = src/libexec/saturnin-demo-dump
62
     libexec = src/libexec/saturnin-demo-dump
63
     libexec = src/libexec/saturnin-demo-echo
63
     libexec = src/libexec/saturnin-demo-echo
64
     libexec = src/libexec/saturnin-demo-greet
64
     libexec = src/libexec/saturnin-demo-greet
65
+    libexec = src/libexec/saturnin-demo-yell
65
     sfincb  = src/shellfu/saturnin_demo_greet.sh
66
     sfincb  = src/shellfu/saturnin_demo_greet.sh
66
     share   = src/help
67
     share   = src/help
67
     share   = src/ini.d
68
     share   = src/ini.d

+ 1
- 0
packaging/debian/saturnin-demo.install View File

3
 /usr/libexec/saturnin-demo/saturnin-demo-dump
3
 /usr/libexec/saturnin-demo/saturnin-demo-dump
4
 /usr/libexec/saturnin-demo/saturnin-demo-echo
4
 /usr/libexec/saturnin-demo/saturnin-demo-echo
5
 /usr/libexec/saturnin-demo/saturnin-demo-greet
5
 /usr/libexec/saturnin-demo/saturnin-demo-greet
6
+/usr/libexec/saturnin-demo/saturnin-demo-yell
6
 /usr/share/doc/saturnin-demo/README.md
7
 /usr/share/doc/saturnin-demo/README.md
7
 /usr/share/saturnin-demo/help
8
 /usr/share/saturnin-demo/help
8
 /usr/share/saturnin-demo/ini.d/main/echo.ini
9
 /usr/share/saturnin-demo/ini.d/main/echo.ini

+ 1
- 0
packaging/template.spec View File

56
 %{_libexecdir}/%{name}/%{name}-dump
56
 %{_libexecdir}/%{name}/%{name}-dump
57
 %{_libexecdir}/%{name}/%{name}-echo
57
 %{_libexecdir}/%{name}/%{name}-echo
58
 %{_libexecdir}/%{name}/%{name}-greet
58
 %{_libexecdir}/%{name}/%{name}-greet
59
+%{_libexecdir}/%{name}/%{name}-yell
59
 
60
 
60
 %files -n shellfu-bash-saturnin_demo
61
 %files -n shellfu-bash-saturnin_demo
61
 %{sfincb}/saturnin_demo_greet.sh
62
 %{sfincb}/saturnin_demo_greet.sh

+ 26
- 0
src/libexec/saturnin-demo-yell View File

1
+#!/bin/bash
2
+
3
+#shellcheck disable=SC1090
4
+. "$(sfpath)" || exit 3
5
+
6
+shellfu import pretty
7
+
8
+usage() {
9
+    mkusage "$@" \
10
+        "warn LINE.."       \
11
+        "think LINE.."      \
12
+        "debug LINE.."
13
+}
14
+
15
+main() {
16
+    local pretty_fn=$1; shift
17
+    case $pretty_fn in
18
+        warn|think|debug) : ;;
19
+        "") usage ;;
20
+        *)  usage -w "unknown severity: $pretty_fn" ;;
21
+    esac
22
+    test $# -gt 0 || usage
23
+    PRETTY_VERBOSE=true PRETTY_DEBUG=true $pretty_fn -l "$@"
24
+}
25
+
26
+main "$@"