mbland / go-script-bash

Framework for writing modular, discoverable, testable Bash scripts
ISC License
95 stars 16 forks source link

Is the Variables and pluging scoping README example right? #253

Open jgomo3 opened 5 years ago

jgomo3 commented 5 years ago

It says:

_GO_ROOTDIR: /absolute/path/to/project-root
_GO_CORE_DIR: /absolute/path/to/project-root/scripts/go-script-bash
_GO_SCRIPTS_DIR: $_GO_ROOTDIR/scripts
_GO_PLUGINS_DIR: /absolute/path/to/project-root/plugins

When I think it should say

_GO_ROOTDIR: /absolute/path/to/project-root
_GO_CORE_DIR: /absolute/path/to/project-root/scripts/go-script-bash
_GO_SCRIPTS_DIR: $_GO_ROOTDIR/scripts
_GO_PLUGINS_DIR: /absolute/path/to/project-root/scripts/plugins

And maybe could reuse the $_GO_ROOTDIR as _GO_SCRIPTS_DIR is doing it

_GO_ROOTDIR: /absolute/path/to/project-root
_GO_CORE_DIR: $_GO_ROOTDIR/scripts/go-script-bash
_GO_SCRIPTS_DIR: $_GO_ROOTDIR/scripts
_GO_PLUGINS_DIR: $_GO_ROOTDIR/scripts/plugins

Or not doing it at all, but do be consistent:

_GO_ROOTDIR: /absolute/path/to/project-root
_GO_CORE_DIR: /absolute/path/to/project-root/scripts/go-script-bash
_GO_SCRIPTS_DIR: /absolute/path/to/project-root/scripts
_GO_PLUGINS_DIR: /absolute/path/to/project-root/scripts/plugins

Given that the example directory structure is:

project-root/
  go - main ./go script
  lib/ - publicly-exported modules (if the project is a go-bash-script plugin)
  scripts/ (or bin/) - project (or plugin) ./go command scripts
    lib/ - project-specific Bash library modules (see "Modules" section)
    plugins/ - (optional) third-party command scripts (see `./go help plugins`)
      .../
        bin/ - plugin ./go command scripts
        lib/ - publicly-exported Bash library modules (see "Modules" section)
    go-script-bash/
      go-core.bash - top-level functions
      lib/ - publicly-exported Bash library modules (see "Modules" section)
      libexec/ - builtin ./go command scripts