Sha256: 14633f6bf041438516b7cdb7b736d5cf526c87023e2e5e05fd06dc30558527f0

Contents?: true

Size: 794 Bytes

Versions: 16

Compression:

Stored size: 794 Bytes

Contents

# frozen_string_literal: true

# takelage self list
module SelfList
  # Backend method for config self.
  def self_list
    # use Thorfile which requires relative takelage.rb
    thorfile_dir = "#{File.dirname(__FILE__)}/../"

    # use thor list to get the list of commands and subcommands
    cmd_thor_list = "bash -c '" \
        "cd #{thorfile_dir} && " \
        'thor list' \
        "'"
    thor_list = `#{cmd_thor_list}`

    # manipulate thor list output
    _manipulate_output_(thor_list)
  end

  private

  def _manipulate_output_(thor_list)
    thor_list.gsub!("takelage\n", '')
    thor_list.gsub!("------\n", '')
    thor_list.gsub!('thor ', 'tau ')
    thor_list.gsub!(/(.*)takelage:c_l_i:(.*)#(.*)/, '\1\2               #\3')
    thor_list.gsub!(/.*COMMAND.*\n/, '')
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
takelage-0.19.2 lib/takelage/self/list.rb
takelage-0.19.1 lib/takelage/self/list.rb
takelage-0.19.0 lib/takelage/self/list.rb
takelage-0.18.1 lib/takelage/self/list.rb
takelage-0.18.0 lib/takelage/self/list.rb
takelage-0.17.1 lib/takelage/self/list.rb
takelage-0.17.0 lib/takelage/self/list.rb
takelage-0.16.0 lib/takelage/self/list.rb
takelage-0.15.1 lib/takelage/self/list.rb
takelage-0.15.0 lib/takelage/self/list.rb
takelage-0.14.5 lib/takelage/self/list.rb
takelage-0.14.4 lib/takelage/self/list.rb
takelage-0.14.3 lib/takelage/self/list.rb
takelage-0.14.2 lib/takelage/self/list.rb
takelage-0.14.1 lib/takelage/self/list.rb
takelage-0.14.0 lib/takelage/self/list.rb