       @close()
     else
       @open()
+
+  cd: (args)->
+    dir = resolve @cwd, args[0]
+    fs.stat dir, (err, stat) =>
+      @showCmd()
+      if err
+        if err.code == 'ENOENT'
+          return @cliOutput.append "cd: #{args[0]}: No such file or directory"
+        return @cliOutput.append err.message
+      if not stat.isDirectory()
+        return @cliOutput.append "cd: not a directory: #{args[0]}"
+      @cwd = dir
+      @cliOutput.append "cwd: #{@cwd}"

        @subview 'cmdEditor', new EditorView(mini: true, placeholderText: 'input your command here')

  initialize: ->
    atom.workspaceView.command "cli-status:toggle-output", =>
      @toggle()


      htmlStream = ansihtml()
      @cmdEditor.hide()
      @cliOutput.append "\n$>#{inputCmd}\n"

      htmlStream.on 'data', (data) =>
        @cliOutput.append data
