# File lib/rhc/context_helper.rb, line 102
    def find_app(opts={})
      if id = options.application_id.presence
        if opts.delete(:with_gear_groups)
          return rest_client.find_application_by_id_gear_groups(id, opts)
        else
          return rest_client.find_application_by_id(id, opts)
        end
      end
      option = (opts && opts[:app]) || options.app
      domain, app =
        if option
          if option =~ /\//
            option.split(/\//)
          else
            [options.namespace || namespace_context, option]
          end
        end
      if app.present? && domain.present?
        if opts.delete(:with_gear_groups)
          rest_client.find_application_gear_groups(domain, app, opts)
        else
          rest_client.find_application(domain, app, opts)
        end
      else
        raise ArgumentError, "You must specify an application with -a, or run this command from within Git directory cloned from OpenShift."
      end
    end