class Tomago::Command

Public Class Methods

dispatch(m, args, options, config) click to toggle source
Calls superclass method
# File lib/tomago/command.rb, line 19
def dispatch(m, args, options, config)
  # Allow calling for help via:
  #   tomago command help
  #   tomago command -h
  #   tomago command --help
  #   tomago command -D
  #
  # as well thor's normal way:
  #
  #   tomago help command
  help_flags = Thor::HELP_MAPPINGS + ["help"]
  if args.length > 1 && !(args & help_flags).empty?
    args -= help_flags
    args.insert(-2, "help")
  end

  #   tomago version
  #   tomago --version
  #   tomago -v
  version_flags = ["--version", "-v"]
  if args.length == 1 
    
    if !(args & version_flags).empty?
      args = ["version"]
    else
      args.unshift("launch")
    end
  end

  super
end