mbland / go-script-bash

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

@go.show_subcommands returns only subcommands from the first command #238

Open nkakouros opened 6 years ago

nkakouros commented 6 years ago

Due diligence

Framework, Bash, and operating system version information

_GO_CORE_VERSION:         v1.7.0
BASH_VERSION:             4.4.12(1)-release
OSTYPE:                   linux-gnu
_GO_PLATFORM_ID:          arch
_GO_PLATFORM_VERSION_ID:  

Description

Given a script structure like this:

scripts/
  command
  command.d/
    subcommand1
    subcommand2
    subcommand2.d/
      subsub1
      subsub2

adding:

. "$_GO_USE_MODULES" 'subcommands'                            
@go.show_subcommands

to subcommand2 will print:

Available subcommands of "subcommand2" are:

subcommand1   No description available
subcommand2   No description available

when

Available subcommands of "subcommand2" are:

subsub1   No description available
subsub2   No description available

should be printed.

The reason seems to be that @go.show_subcommands uses the $_GO_CMD_NAME to find the subcommands.

shafiqalibhai commented 6 years ago

+1