Browse Source

Re-package with better granularity

Switch to packaging model where each module goes into separate package.

Such model makes much more sense (after all it's also how big platforms
such as python do it).  It allows better control over dependencies and
allows re-locating modules properly according to compatibility level
(i.e. now exit.sh can go to 'sh' despite the fact that in 'core' it had
to be with other Bash-compatible modules).
Alois Mahdal 6 years ago
parent
commit
d3bdd92073

+ 61
- 10
packaging/debian/control View File

@@ -40,10 +40,10 @@ Description: Bash-specific base
40 40
  This sub-package contains Bash-specific parts of library infrastructure.
41 41
  Shellfu modules written for Bash should depend on this.
42 42
 
43
-Package: shellfu-bash-core
43
+Package: shellfu-bash-inigrep
44 44
 Architecture: all
45
-Depends: shellfu-bash
46
-Description: Core Bash modules for Shellfu
45
+Depends: shellfu-bash, shellfu-bash-pretty
46
+Description: INI grepping Shellfu/Bash module
47 47
  Shellfu is an attempt to add modularity to your shell scripts.
48 48
  .
49 49
  With Shellfu you can develop your shell modules separately from your
@@ -54,12 +54,13 @@ Description: Core Bash modules for Shellfu
54 54
  amount of reliable body of shell scripts, and access to advanced modular
55 55
  languages such as Python or Perl is limited.
56 56
  .
57
- This sub-package contains core Shellfu modules.
57
+ This sub-package contains 'inigrep', Shellfu/Bash module for reading
58
+ INI-like files.
58 59
 
59
-Package: shellfu-bash-extras
60
+Package: shellfu-bash-pretty
60 61
 Architecture: all
61
-Depends: shellfu-bash, shellfu-bash-core
62
-Description: Extra Bash modules for Shellfu
62
+Depends: shellfu-bash
63
+Description: Logging Shellfu/Bash module
63 64
  Shellfu is an attempt to add modularity to your shell scripts.
64 65
  .
65 66
  With Shellfu you can develop your shell modules separately from your
@@ -70,12 +71,11 @@ Description: Extra Bash modules for Shellfu
70 71
  amount of reliable body of shell scripts, and access to advanced modular
71 72
  languages such as Python or Perl is limited.
72 73
  .
73
- This sub-package contains extra Shellfu modules, most of them under
74
- heavy development.
74
+ This sub-package contains 'pretty', universal Shellfu logging module.
75 75
 
76 76
 Package: shellfu-devel
77 77
 Architecture: all
78
-Depends: shellfu-bash-core
78
+Depends: shellfu-bash-pretty
79 79
 Description: Essential developer tools
80 80
  Shellfu is an attempt to add modularity to your shell scripts.
81 81
  .
@@ -107,6 +107,40 @@ Description: Bash-specific base
107 107
  This sub-package contains POSIX-oriented parts of library infrastructure.
108 108
  Generic Shellfu modules aiming for POSIX compatibility should depend on this.
109 109
 
110
+Package: shellfu-sh-charmenu
111
+Architecture: all
112
+Depends: shellfu-sh
113
+Description: Shellfu/sh module for building interactive terminal menus
114
+ Shellfu is an attempt to add modularity to your shell scripts.
115
+ .
116
+ With Shellfu you can develop your shell modules separately from your
117
+ scripts, and test, use, explore or study them without need to be aware
118
+ of details such as where the actual files are placed.
119
+ .
120
+ Shellfu is mostly intended for cases when there's need for non-trivial
121
+ amount of reliable body of shell scripts, and access to advanced modular
122
+ languages such as Python or Perl is limited.
123
+ .
124
+ This sub-package contains 'charmenu', a Shellfu/sh module for building
125
+ interactive terminal menus
126
+
127
+Package: shellfu-sh-exit
128
+Architecture: all
129
+Depends: shellfu-sh
130
+Description: Shellfu/sh module for standard exit statuses
131
+ Shellfu is an attempt to add modularity to your shell scripts.
132
+ .
133
+ With Shellfu you can develop your shell modules separately from your
134
+ scripts, and test, use, explore or study them without need to be aware
135
+ of details such as where the actual files are placed.
136
+ .
137
+ Shellfu is mostly intended for cases when there's need for non-trivial
138
+ amount of reliable body of shell scripts, and access to advanced modular
139
+ languages such as Python or Perl is limited.
140
+ .
141
+ This sub-package contains 'exit', Shellfu module containing functions
142
+ and variables for standard exit statuses.
143
+
110 144
 Package: shellfu-sh-mdfmt
111 145
 Architecture: all
112 146
 Depends: shellfu-sh
@@ -124,5 +158,22 @@ Description: Markdown formatting helper
124 158
  This sub-package contains Markdown formatting helper, a function that
125 159
  Helps you generate Markdown paragraph elements from your shell scripts.
126 160
 
161
+Package: shellfu-sh-termcolors
162
+Architecture: all
163
+Depends: shellfu-sh
164
+Description: Shellfu/sh module for terminal color names
165
+ Shellfu is an attempt to add modularity to your shell scripts.
166
+ .
167
+ With Shellfu you can develop your shell modules separately from your
168
+ scripts, and test, use, explore or study them without need to be aware
169
+ of details such as where the actual files are placed.
170
+ .
171
+ Shellfu is mostly intended for cases when there's need for non-trivial
172
+ amount of reliable body of shell scripts, and access to advanced modular
173
+ languages such as Python or Perl is limited.
174
+ .
175
+ This sub-package contains 'termcolors', Shellfu module containing most
176
+ common ANSI color names.
177
+
127 178
 
128 179
 # control file built with MKit __MKIT_SELF_VERSION__

+ 0
- 2
packaging/debian/shellfu-bash-extras.install View File

@@ -1,2 +0,0 @@
1
-/usr/share/shellfu/include-bash/charmenu.sh
2
-/usr/share/shellfu/include-bash/inigrep.sh

+ 1
- 0
packaging/debian/shellfu-bash-inigrep.install View File

@@ -0,0 +1 @@
1
+/usr/share/shellfu/include-bash/inigrep.sh

packaging/debian/shellfu-bash-core.install → packaging/debian/shellfu-bash-pretty.install View File

@@ -3,6 +3,4 @@
3 3
 /usr/share/shellfu/include-bash/_pretty_journald.sh
4 4
 /usr/share/shellfu/include-bash/_pretty_notify.sh
5 5
 /usr/share/shellfu/include-bash/_pretty_plain.sh
6
-/usr/share/shellfu/include-bash/exit.sh
7 6
 /usr/share/shellfu/include-bash/pretty.sh
8
-/usr/share/shellfu/include-bash/termcolors.sh

+ 1
- 0
packaging/debian/shellfu-sh-charmenu.install View File

@@ -0,0 +1 @@
1
+/usr/share/shellfu/include-sh/charmenu.sh

+ 1
- 0
packaging/debian/shellfu-sh-exit.install View File

@@ -0,0 +1 @@
1
+/usr/share/shellfu/include-sh/exit.sh

+ 1
- 0
packaging/debian/shellfu-sh-termcolors.install View File

@@ -0,0 +1 @@
1
+/usr/share/shellfu/include-sh/termcolors.sh

+ 46
- 18
packaging/template.spec View File

@@ -31,23 +31,24 @@ Requires: shellfu
31 31
 This sub-package contains Bash-specific parts of library infrastructure.
32 32
 Shellfu modules written for Bash should depend on this.
33 33
 
34
-%package bash-core
35
-Summary: Core Bash modules for Shellfu
34
+%package bash-inigrep
35
+Summary: INI grepping Shellfu/Bash module
36 36
 Requires: shellfu-bash
37
-%description bash-core
38
-This sub-package contains core Shellfu modules.
37
+Requires: shellfu-bash-pretty
38
+%description bash-inigrep
39
+This sub-package contains 'inigrep', Shellfu/Bash module for reading
40
+INI-like files.
39 41
 
40
-%package bash-extras
41
-Summary: Extra Bash modules for Shellfu
42
+%package bash-pretty
43
+Summary: Logging Shellfu/Bash module
42 44
 Requires: shellfu-bash
43
-Requires: shellfu-bash-core
44
-%description bash-extras
45
-This sub-package contains extra Shellfu modules, most of them under
46
-heavy development.
45
+Requires: shellfu-sh-termcolors
46
+%description bash-pretty
47
+This sub-package contains 'pretty', universal Shellfu logging module.
47 48
 
48 49
 %package devel
49 50
 Summary: Essential developer tools
50
-Requires: shellfu-bash-core
51
+Requires: shellfu-bash-pretty
51 52
 %description devel
52 53
 This sub-package contains tools useful mostly for development of shellfu
53 54
 scripts.
@@ -59,6 +60,20 @@ Requires: shellfu
59 60
 This sub-package contains POSIX-oriented parts of library infrastructure.
60 61
 Generic Shellfu modules aiming for POSIX compatibility should depend on this.
61 62
 
63
+%package sh-charmenu
64
+Summary: Shellfu/sh module for building interactive terminal menus
65
+Requires: shellfu-sh
66
+%description sh-charmenu
67
+This sub-package contains 'charmenu', a Shellfu/sh module for building
68
+interactive terminal menus
69
+
70
+%package sh-exit
71
+Summary: Shellfu/sh module for standard exit statuses
72
+Requires: shellfu-sh
73
+%description sh-exit
74
+This sub-package contains 'exit', Shellfu module containing few
75
+common ANSI color names.
76
+
62 77
 %package sh-mdfmt
63 78
 Summary: Markdown formatting helper
64 79
 Requires: shellfu-sh
@@ -66,6 +81,13 @@ Requires: shellfu-sh
66 81
 This sub-package contains Markdown formatting helper, a function that
67 82
 helps you generate Markdown paragraph elements from your shell scripts.
68 83
 
84
+%package sh-termcolors
85
+Summary: Shellfu/sh module for terminal color names
86
+Requires: shellfu-sh
87
+%description sh-termcolors
88
+This sub-package contains 'termcolors', Shellfu module containing most
89
+common ANSI color names.
90
+
69 91
 
70 92
 %prep
71 93
 %setup -q
@@ -94,19 +116,16 @@ make test \
94 116
 %files bash
95 117
 %dir %{_datadir}/%{name}/include-bash
96 118
 
97
-%files bash-core
119
+%files bash-inigrep
120
+%{_datadir}/%{name}/include-bash/inigrep.sh
121
+
122
+%files bash-pretty
98 123
 %{_datadir}/%{name}/include-bash/_pretty_color.sh
99 124
 %{_datadir}/%{name}/include-bash/_pretty_html.sh
100 125
 %{_datadir}/%{name}/include-bash/_pretty_journald.sh
101 126
 %{_datadir}/%{name}/include-bash/_pretty_notify.sh
102 127
 %{_datadir}/%{name}/include-bash/_pretty_plain.sh
103
-%{_datadir}/%{name}/include-bash/exit.sh
104 128
 %{_datadir}/%{name}/include-bash/pretty.sh
105
-%{_datadir}/%{name}/include-bash/termcolors.sh
106
-
107
-%files bash-extras
108
-%{_datadir}/%{name}/include-bash/charmenu.sh
109
-%{_datadir}/%{name}/include-bash/inigrep.sh
110 129
 
111 130
 %files devel
112 131
 %{_bindir}/sfembed
@@ -114,9 +133,18 @@ make test \
114 133
 %files sh
115 134
 %dir %{_datadir}/%{name}/include-sh
116 135
 
136
+%files sh-charmenu
137
+%{_datadir}/%{name}/include-sh/charmenu.sh
138
+
139
+%files sh-exit
140
+%{_datadir}/%{name}/include-sh/exit.sh
141
+
117 142
 %files sh-mdfmt
118 143
 %{_datadir}/%{name}/include-sh/mdfmt.sh
119 144
 
145
+%files sh-termcolors
146
+%{_datadir}/%{name}/include-sh/termcolors.sh
147
+
120 148
 %changelog
121 149
 
122 150
 # specfile built with MKit __MKIT_SELF_VERSION__

src/include-bash/charmenu.sh → src/include-sh/charmenu.sh View File

@@ -1,4 +1,4 @@
1
-shellfu import pretty
1
+#!/bin/sh
2 2
 
3 3
 
4 4
 CHARMENU_FILE="${CHARMENU_FILE:-}"
@@ -50,7 +50,7 @@ charmenu() {
50 50
     # call `charmenu full arg1 arg2...` to have your arguments
51 51
     # expanded in the full menu.  More fleshed out example:
52 52
     #
53
-    #     . "$(shellfu-get path)" || exit 3
53
+    #     . "$(sfpath)" || exit 3
54 54
     #     shellfu import charmenu
55 55
     #     shellfu import pretty
56 56
     #
@@ -110,7 +110,7 @@ charmenu() {
110 110
             printf "$menu\n" "$@"
111 111
             ;;
112 112
         items)  # print just the list of actions
113
-            paste -sd"$delim" <<<"$alist"
113
+            echo "$alist" paste -sd"$delim"
114 114
             ;;
115 115
         prompt) # print prompt for user
116 116
             printf "$prompt" "$(charmenu items)"
@@ -118,7 +118,7 @@ charmenu() {
118 118
         has)    # check if response is valid ("on the menu")
119 119
             local res="$1"
120 120
             test -n "$res" || return 1      # "" is not valid
121
-            grep $cases -e "^$res$" <<<"$alist"
121
+            echo "$alist" | grep $cases -e "^$res$"
122 122
             return $?
123 123
             ;;
124 124
     esac

src/include-bash/exit.sh → src/include-sh/exit.sh View File

@@ -1,4 +1,4 @@
1
-#!/bin/bash
1
+#!/bin/sh
2 2
 
3 3
 
4 4
 EXIT_OK=0

src/include-bash/termcolors.sh → src/include-sh/termcolors.sh View File

@@ -1,4 +1,4 @@
1
-#!/bin/bash
1
+#!/bin/sh
2 2
 
3 3
 #
4 4
 # Color definitions