Sha256: c5186ee951f3af36847df6e7ce5e97819624ab54f2e299fe359ce5a87704b271

Contents?: true

Size: 991 Bytes

Versions: 1

Compression:

Stored size: 991 Bytes

Contents

class DevSystem::NotFoundCommand < DevSystem::Command

  def self.call args
    # 1. LOG

    log "args = #{args.inspect}"
    puts

    # 2. FIND commands

    App.load_all
    commands = Liza::Command.descendants
    commands -= ignored_commands

    # 3. LIST commands

    keys = commands.map { _1.last_namespace.snakecase[0..-9] }.uniq.sort

    log "Liza comes with #{keys.count} commands you can use."
    log "Here they are:"
    puts

    keys.each { |s| log "liza #{s}" }
  end

  def self.ignored_commands
    [
      self,
      DevSystem::NotFoundCommand,
      DevSystem::NewCommand,
      DevSystem::TerminalCommand,
      (DevSystem::NarrativeMethodCommand if defined? NarrativeMethodCommand),
    ].uniq.compact
  end

  if $APP == "app_global"
    def self.ignored_commands
      [
        self,
        DevSystem::NotFoundCommand,
        DevSystem::BenchCommand,
        DevSystem::GenerateCommand,
        DevSystem::TestCommand,
      ].uniq.compact
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lizarb-1.0.4 lib/dev_system/dev/controllers/command/not_found_command.rb