 
       # `exec` handles the execution of the command.
       exec: (cmd, args, callback) ->
-        get command_name, null, (data) ->
-          return err("api request failed to get data")  unless data
-          template = _self.shell.templates[command_name]
-          template = template or _self.shell.templates.default_template
-          template_args = {}
-          template_args[command_name] = template_args["data"] = data
-          _console.debug "[Josh.FeedlyConsole] data %O cmd %O args %O",
-          data, cmd, args
-          callback template(template_args)
+        if _self.api
+          _self.api.get command_name, null, (data) ->
+            return err("api request failed to get data")  unless data
+            template = _self.shell.templates[command_name]
+            template = template or _self.shell.templates.default_template
+            template_args = {}
+            template_args[command_name] = template_args["data"] = data
+            _console.debug "[Josh.FeedlyConsole] data %O cmd %O args %O",
+            data, cmd, args
+            callback template(template_args)
+        else
+          callback _self.shell.templates.not_ready({cmd})
 
 
     simple_commands = [










    # Supporting Functions
    # ====================
    ###
    #<section id='get'/>

    # get
    # ---

    # This function is responsible for all API requests, given a
    # partial API path, `resource`, and an query argument object,
    # `args`.
    ###
    get = (resource, args, callback) ->
      cacheCallback = (value) ->
        _self[resource] = value
        callback value
      url = _self.api + resource
      cache = _self[resource]
      return callback(cache)  if cache
      unless chrome.extension?
        # not embedded, demo mode
        demo = demo_data[resource]
        demo = {} unless demo?
        _self[resource] = demo
        callback _self[resource]
      else
        if args
          url += "?" + _.map(args, (v, k) ->
            k + "=" + v
          ).join("&")
        _console.debug "[Josh.FeedlyConsole] fetching %s.", url
        request =
          url: url
          dataType: "json"
          headers:
            Authorization: "OAuth " + _self.OAuth

          xhrFields:
            withCredentials: true

        $.ajax(request).done (response, status, xhr) ->

          # Every response from the API includes rate limiting
          # headers, as well as an indicator injected by the API proxy
          # whether the request was done with authentication. Both are
          # used to display request rate information and a link to
          # authenticate, if required.
          ratelimit =
            remaining: parseInt(xhr.getResponseHeader("X-RateLimit-Remaining"))
            limit: parseInt(xhr.getResponseHeader("X-RateLimit-Limit"))
            authenticated: xhr.getResponseHeader("Authenticated") is "true"

          $("#ratelimit").html _self
          .shell.templates.rateLimitTemplate(ratelimit)
          if ratelimit.remaining is 0
            alert "Whoops, you've hit the github rate limit. You'll need
 to authenticate to continue"
            _self.shell.deactivate()
            return null

          # For simplicity, this tutorial trivially deals with request
          # failures by just returning null from this function via the
          # callback.
          return callback()  if status isnt "success"
          cacheCallback response


    #<section id='initialize'/>

    # initalize

      chrome.runtime.onMessage.addListener (request, sender, sendResponse) ->
        _console.debug "[feedlyconsole] msg: %s.", request.msg
        if request.action is "icon_active"
          _console.debug "[feedlyconsole/icon_active] ignore."
        else if request.action is "toggle_console"
          unless _self.ui.toggleActivateAndShow?
            window.console.warn "[feedlyconsole] ui not yet ready"
          else
            _self.ui.toggleActivateAndShow()
        else if request.action is "cookie_feedlytoken"
          unless _self.api
            OAuth = request.feedlytoken

            url_array = request.url.split("/")
            url = url_array[0] + "//" + url_array[2]
            _console.debug """
            [feedlyconsole/cookie_feedlytoken] url: %s oauth: %s.""",
              url,
              _self.OAuth.slice(0, 8)
            _self.api = new FeedlyApiRequest(url,
              FEEDLY_API_VERSION,
              OAuth)
          else
            _console.debug """
            [feedlyconsole/cookie_feedlytoken]
             ignoreing, already initialized."""
        else
          _console.debug "[feedlyconsole] unknown action %s request %O.",
          request.action, request
