瀏覽代碼

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 年之前
父節點
當前提交
385e1ba4c6
共有 4 個檔案被更改,包括 29 行新增0 行删除
  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 查看文件

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

+ 1
- 0
packaging/debian/saturnin-demo.install 查看文件

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

+ 1
- 0
packaging/template.spec 查看文件

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

+ 26
- 0
src/libexec/saturnin-demo-yell 查看文件

@@ -0,0 +1,26 @@
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 "$@"