|
@@ -28,118 +28,9 @@ Project Status and Versioning
|
28
|
28
|
work on it.
|
29
|
29
|
|
30
|
30
|
|
31
|
|
-Introduction
|
|
31
|
+Installation
|
32
|
32
|
------------
|
33
|
33
|
|
34
|
|
-Most shell languages don't have libraries.
|
35
|
|
-
|
36
|
|
-You might think: "Are you kidding me? Libraries are for real serious
|
37
|
|
-programmers, and real serious programmers don't real-serious-program
|
38
|
|
-in shell! So how is that a problem lol."
|
39
|
|
-
|
40
|
|
-I mostly agree. Shell languages, by definition are command languages,
|
41
|
|
-basically meant to allow you kick around files, create directories and
|
42
|
|
-most importantly, launch *other* real serious programs.
|
43
|
|
-
|
44
|
|
-What shell languages can also be used for is gluing together some of
|
45
|
|
-these real serious programs so that you don't have to type everything
|
46
|
|
-over and over. These glue scripts are normally nothing serious, just
|
47
|
|
-copy this there and launch that with that piped in. Done.
|
48
|
|
-
|
49
|
|
-*Granted,* in some cases, you simply don't stop there. Sometimes you
|
50
|
|
-create one script here, one script there, one over there. When you
|
51
|
|
-maintain a system, sometimes you do write scripties here and there.
|
52
|
|
-That's OK, all of them are just few lines; trivial things with obvious
|
53
|
|
-purpose, right?
|
54
|
|
-
|
55
|
|
-But sometimes, you don't work alone. Sometimes there's bunch of other
|
56
|
|
-folks and you want to work together so that when you take vacation and
|
57
|
|
-something breaks, your colleagues can use your scripts instead of
|
58
|
|
-needing to do everything manually or call you.
|
59
|
|
-
|
60
|
|
-So even if it's not real serious web application or real serious kernel,
|
61
|
|
-*some* level of re-usability pays off.
|
62
|
|
-
|
63
|
|
-
|
64
|
|
-### OK so what ###
|
65
|
|
-
|
66
|
|
-It's not that it's not possible to build a library from a bunch of scripts
|
67
|
|
-and import all with the magical dot command, but let's be honest: you end
|
68
|
|
-up either with swarm of modules of varying style, maturity and quality
|
69
|
|
-*and* overlapping scopes, or one humongous beast-of-a-module with pack
|
70
|
|
-of mysterious functions and variables that everyone is scared to touch.
|
71
|
|
-
|
72
|
|
-Unless you take it seriously and start thinking *way* ahead from the
|
73
|
|
-start.
|
74
|
|
-
|
75
|
|
-Which is exactly what I did.
|
76
|
|
-
|
77
|
|
-Finding myself in swarm of varying scripties, constantly trying to keep
|
78
|
|
-them at least a bit tidy, I decided to stop and do it another way: Just
|
79
|
|
-try and see how much of the magic, the modularity, maintainability and
|
80
|
|
-discoverability that's so common in other platforms could be taken into
|
81
|
|
-the dark, blunt world of shell languages.
|
82
|
|
-
|
83
|
|
-Result of these efforts is called Shellfu.
|
84
|
|
-
|
85
|
|
-
|
86
|
|
-### So what does it do? ###
|
87
|
|
-
|
88
|
|
-Shellfu, as a project consists of three parts:
|
89
|
|
-
|
90
|
|
- * `shellfu()`, the shell function that lets you import a module from
|
91
|
|
- known location just by name, therefore decoupling the *deployment*
|
92
|
|
- from *the dependency*.
|
93
|
|
-
|
94
|
|
- * Shellfu core library, providing few modules readily usable for
|
95
|
|
- some of the most common tasks (printing messages for user, loading
|
96
|
|
- basic INI files...).
|
97
|
|
-
|
98
|
|
- Note that this "library" is currently extremely tiny with about
|
99
|
|
- 4-6 modules. It's currently (July 2016) not clear what modules
|
100
|
|
- should be added or removed and what should be the size, although
|
101
|
|
- there are no plans to add a lot. Most of advantage of shellfu
|
102
|
|
- is to be gained from writing *domain-specific* modules.
|
103
|
|
-
|
104
|
|
- * Shellfu Style Guide, setting common standard for shell modules,
|
105
|
|
- allowing you to collaborate on the code in an efficient manner
|
106
|
|
- (in-line documentation, peer review, code readability...).
|
107
|
|
-
|
108
|
|
- * As a bonus, *shellfu-doc*, building upon the Shellfu Style Guide,
|
109
|
|
- allows your user to discover and read documentation of installed
|
110
|
|
- modules (akin to *perldoc* or *pydoc*).
|
111
|
|
-
|
112
|
|
-
|
113
|
|
-### Schizophrenia kicks in ###
|
114
|
|
-
|
115
|
|
-> *So are we talking POSIX shell, Bash or Zsh or what?*
|
116
|
|
-
|
117
|
|
-The basic principle is, albeit untested, meant to be extensible to most
|
118
|
|
-common *bourne-like* shell languages. In more specific sense, this
|
119
|
|
-means two things:
|
120
|
|
-
|
121
|
|
- * *shellfu.sh*, the core part of the code should be compatible with
|
122
|
|
- *dash*, the Debian Almquist Shell,
|
123
|
|
-
|
124
|
|
- * although I don't expect various-language modules to co-exist,
|
125
|
|
- *shellfu.sh* aims to be able to filter modules based on interpreter
|
126
|
|
- (more on that later).
|
127
|
|
-
|
128
|
|
- * and some modules of the core library will try to be POSIX/dash
|
129
|
|
- compatible, which will make them loadable from all.
|
130
|
|
-
|
131
|
|
-Note that I'm kind of using terms "POSIX" and "dash" interchangeably.
|
132
|
|
-What I really mean is that since POSIX is rather vague in many places,
|
133
|
|
-and there are kajilions of POSIX shells, it's impractical to aim for
|
134
|
|
-*real* POSIX compatibility. Therefore, the "POSIX-oriented" code will
|
135
|
|
-be tested under *dash*, plus set of most common interpreters: `bash`,
|
136
|
|
-(add here).
|
137
|
|
-
|
138
|
|
-I reckon that's about as POSIXey as one can get without going mad.
|
139
|
|
-
|
140
|
|
-
|
141
|
|
-Bring it on!
|
142
|
|
-------------
|
143
|
34
|
|
144
|
35
|
### Installation ###
|
145
|
36
|
|