Thor third level subcommand not represented correctly in output

35 Views Asked by At

I am having an issues in thor 1.2.1 where the 3rd level command isn't representing the help correctly. Here is some demo code:

#! /usr/bin/env ruby

require "thor"

module SubCommand2
  class Cli < Thor
    desc "hello NAME", "say hello to NAME"
    def hello(name)
      puts "Hello #{name}"
    end
  end
end

module SubCommand1
  class Cli < Thor
    desc "hello NAME", "say hello to NAME"
    def hello(name)
      puts "Hello #{name}"
    end

    desc "subcommand2 [COMMAND]", "SubCommand2 Project Commands"
    long_desc "SubCommand2 Commands"
    subcommand "subcommand2", SubCommand2::Cli
  end
end


module Demo
  class Cli < Thor
    desc "hello NAME", "say hello to NAME"
    def hello(name)
      puts "Hello #{name}"
    end

    desc "subcommand1 [COMMAND]", "SubCommand1 Project Commands"
    long_desc "SubCommand1 Commands"
    subcommand "subcommand1", SubCommand1::Cli
  end
end

Demo::Cli.start(ARGV)

If I call out to the deepest level subcommand the parent commands isn't represented:

#> ./demo subcommand1 subcommand2
Commands:
  demo subcommand2 hello NAME      # say hello to NAME
  demo subcommand2 help [COMMAND]  # Describe subcommands or one specific subcommand

The expected output should be

#> ./demo subcommand1 subcommand2
Commands:
  demo subcommand1 subcommand2 hello NAME      # say hello to NAME
  demo subcommand1 subcommand2 help [COMMAND]  # Describe subcommands or one specific subcommand

Is this a bug or am I missing something?

Thank you for your time.

0

There are 0 best solutions below