@@ -274,17 +274,18 @@ interpreted as relative to the project root.
274274Your project structure may look something like this:
275275
276276```
277- project/
277+ project-root /
278278 go - main ./go script
279- scripts/ - project ./go command scripts
279+ lib/ - publicly-exported modules (if the project is a go-bash-script plugin)
280+ scripts/ (or bin/) - project (or plugin) ./go command scripts
280281 lib/ - project-specific Bash library modules (see "Modules" section)
281282 plugins/ - (optional) third-party command scripts (see `./go help plugins`)
282283 .../
283284 bin/ - plugin ./go command scripts
284- lib/ - optional Bash library modules (see "Modules" section)
285+ lib/ - publicly-exported Bash library modules (see "Modules" section)
285286 go-script-bash/
286287 go-core.bash - top-level functions
287- lib/ - optional Bash library modules (see "Modules" section)
288+ lib/ - publicly-exported Bash library modules (see "Modules" section)
288289 libexec/ - builtin ./go command scripts
289290```
290291
@@ -293,11 +294,20 @@ This structure implies that the first line of your `./go` script will be:
293294. " ${0%/* } /scripts/go-script-bash/go-core.bash" " scripts"
294295```
295296
296- The precedence for discovering commands is:
297+ #### Variables and plugin scoping
297298
298- - aliases/builtins (provided by this framework)
299- - plugins (in ` scripts/plugins ` above)
300- - project scripts (in ` scripts ` above)
299+ The following variables are set by the framework based on the above example
300+ (note there are many other variables set in ` go-core.bash ` and elsewhere; see
301+ ` ./go help vars ` ):
302+
303+ * ` _GO_ROOTDIR ` : ` /absolute/path/to/project-root `
304+ * ` _GO_CORE_DIR ` : ` /absolute/path/to/project-root/scripts/go-script-bash `
305+ * ` _GO_SCRIPTS_DIR ` : ` $_GO_ROOTDIR/scripts `
306+ * ` _GO_PLUGINS_DIR ` : ` /absolute/path/to/project-root/plugins `
307+
308+ For plugins, ` _GO_ROOTDIR ` and ` _GO_SCRIPTS_DIR ` will be scoped to the root
309+ directory of the plugin installation; the other variables will remain the same.
310+ See ` ./go help plugins ` for more details.
301311
302312#### Command scripts
303313
@@ -316,6 +326,9 @@ need not be written in Bash.__ Bash scripts will be sourced (i.e. imported into
316326the same process running the ` ./go ` script itself). Other languages will use the
317327` PATH ` environment variable to discover the interpreter for the script.
318328
329+ See ` ./go help commands ` for details on the algorithm used to discover command
330+ scripts for execution.
331+
319332#### Command summaries and help text
320333
321334The builtin ` ./go help ` command will parse command script summaries and help
@@ -417,14 +430,15 @@ For more information, run `./go modules --help log`.
417430#### Bats test assertions and helpers
418431
419432The assertions and helpers from the test suite have been extracted into the
420- ` lib/bats/assertions ` , ` lib/bats/helpers ` , and ` lib/bats/assertion-test-helpers `
421- libraries. While these are not modules you can import with ` _GO_USE_MODULES ` ,
422- they are completely independent of the rest of the core framework and you may
423- source them in your own Bats tests. (Whether or not these will ever become a
424- separate library remains an open question.)
433+ ` lib/bats ` libraries. While these are not modules you can import with
434+ ` _GO_USE_MODULES ` , they are completely independent of the rest of the core
435+ framework and you may source them in your own Bats tests. (Whether or not these
436+ will ever become a separate library remains an open question.)
425437
426438Variables, helper functions, and assertions for testing features based on the
427- core framework are available in the ` lib/testing ` directory.
439+ core framework are available in the ` lib/testing ` directory. The ` lib/bats-main `
440+ library makes it easy to write a ` ./go test ` command script with the same
441+ interface and features as the core framework's ` ./go test ` command.
428442
429443Read the comments from each file for more information.
430444
0 commit comments