{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# magicpatch demos"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Still runs normal JavaScript"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hi bob\n"
     ]
    }
   ],
   "source": [
    "var n = \"bob\";\n",
    "console.log(\"hi\", n);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## %magic example\n",
    "Magicpatch adds [%magic commands](https://ipython.readthedocs.io/en/stable/interactive/magics.html) to IJavascript. Magics are intended to make development faster and easier. Here's a magic called %echo that does... pretty much what you would expect:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hi there\n"
     ]
    }
   ],
   "source": [
    "%echo hi there"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## %addmagic"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "You can also add your own magics. The syntax is `%addcmd cmdname fnname`.  `cmdname` must start with a symbol like `%` or `.`, and `fnname` is a string that is the name of a function. `fnname` is not checked to see if it exists until the magic is called. If you want to create a npm module for adding magics, you can use the global method `$$.addMagic()`, which has the same syntax."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ added magic: '%foo' which will call function 'bar' ]\n"
     ]
    }
   ],
   "source": [
    "function bar() {\n",
    "    console.log(\"LETS ALL GO TO THE BAR\");\n",
    "}\n",
    "%addmagic %foo bar"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "LETS ALL GO TO THE BAR\n"
     ]
    }
   ],
   "source": [
    "%foo"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "function sayMyName(cmd, name) {\n",
    "    console.log(\"my name is:\", name);\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ added magic: '%name' which will call function 'sayMyName' ]\n"
     ]
    }
   ],
   "source": [
    "%addmagic %name sayMyName"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "my name is: mud\n"
     ]
    }
   ],
   "source": [
    "%name mud"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## !exec\n",
    "Lines that start with `!` will execute in the underlying shell."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "total 608\n",
      "drwxr-xr-x   9 ampower     288 Jan  3 12:35 ./\n",
      "drwxr-xr-x  19 ampower     608 Jan  3 09:12 ../\n",
      "-rw-r--r--@  1 ampower    6148 Dec 29 08:58 .DS_Store\n",
      "drwxr-xr-x   6 ampower     192 Jan  1 17:41 .ipynb_checkpoints/\n",
      "-rw-r--r--   1 ampower   10673 Dec 31 11:26 Untitled.ipynb\n",
      "-rw-r--r--   1 ampower   21778 Dec 31 17:31 Untitled1.ipynb\n",
      "-rw-r--r--   1 ampower    7567 Jan  3 12:30 Untitled2.ipynb\n",
      "-rw-r--r--   1 ampower   61889 Jan  3 12:35 magicdemo.ipynb\n",
      "-rw-r--r--@  1 ampower  190387 Dec 29 08:56 quickDemo.png\n",
      "[ process 'ls -laoF' exited with code 0 ]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "!ls -laoF"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Untitled.ipynb\n",
      "Untitled1.ipynb\n",
      "Untitled2.ipynb\n",
      "magicdemo.ipynb\n",
      "quickDemo.png\n",
      "[ process 'ls' exited with code 0 ]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "! ls"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[90m                                                                                \u001b[39m\n",
      "\u001b[90m \u001b[39m                      === npm audit security report ===                       \u001b[90m \u001b[39m\n",
      "\u001b[90m                                                                                \u001b[39m\n",
      "found 0 vulnerabilities\n",
      " in 387 scanned packages\n",
      "[ process 'npm audit' exited with code 0 ]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "!npm audit"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Var Assignment\n",
    "The output of %magic and !exec commands can be assigned to a variable for future reference."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ loading /Users/ampower/Projects/personal/magicpatch/test/helpers/testModule.js ]\n"
     ]
    }
   ],
   "source": [
    "let mod = %require ../test/helpers/testModule.js"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Module is: { source: 'helpers/testModule.js', worked: true }\n"
     ]
    }
   ],
   "source": [
    "console.log(\"Module is:\", mod);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Note: IPython's `var = !cmd` format doesn't work becuase `!` is a valid operator in JavaScript. Use `%sx` instead."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ process 'ps -aux' exited with code 1 ]\n",
      "local directory: [ \"ps: No user named 'x'\", '' ]\n"
     ]
    }
   ],
   "source": [
    "dirListing = %sx ps -aux\n",
    "console.log(\"local directory:\", dirListing)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##  {var} substitution"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Using {var} will be replaced with the variable `var`. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "42\n"
     ]
    }
   ],
   "source": [
    "x = 42\n",
    "%echo {x}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{ beer: 'yum' }\n"
     ]
    }
   ],
   "source": [
    "o = {\n",
    "    beer: \"yum\"\n",
    "}\n",
    "%echo {o}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "x42o[object Object]\n"
     ]
    }
   ],
   "source": [
    "%echo x{x}o{o}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## View Documentation\n",
    "`?` before or after a magic will show you it's documentation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "__%echo Documentation:__\n",
       "\n",
       "Usage: %echo &lt;string&gt;<br>\n",
       "<br>\n",
       "Write arguments to the standard output.<br>\n",
       "\n",
       "\n",
       "__File:__ /Users/ampower/Projects/personal/magicpatch/lib/magics/echo.js"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "?%echo"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "__%echo Documentation:__\n",
       "\n",
       "Usage: %echo &lt;string&gt;<br>\n",
       "<br>\n",
       "Write arguments to the standard output.<br>\n",
       "\n",
       "\n",
       "__File:__ /Users/ampower/Projects/personal/magicpatch/lib/magics/echo.js"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%echo?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## View Code\n",
    "`??` before or after a magic will show you the code for the magic."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "__%echo Source:__\n",
       "\n",
       "``` js\n",
       "function echo() {\n",
       "    console.log(this.varSubst(this.line.substring(this.startArgs)));\n",
       "}\n",
       "```\n",
       "\n",
       "__File:__ /Users/ampower/Projects/personal/magicpatch/lib/magics/echo.js"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "??%echo"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "__%echo Source:__\n",
       "\n",
       "``` js\n",
       "function echo() {\n",
       "    console.log(this.varSubst(this.line.substring(this.startArgs)));\n",
       "}\n",
       "```\n",
       "\n",
       "__File:__ /Users/ampower/Projects/personal/magicpatch/lib/magics/echo.js"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%echo??"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Input Caching\n",
    "Previously run commands can be found in a few different ways. The last three commands are available in the global variables `_i`, `_ii`, and `_iii`. All previous commands can be found in the `In` or `_ih` arrays."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "var n = \"bob\";\n",
      "console.log(\"hi\", n);\n"
     ]
    }
   ],
   "source": [
    "console.log(In[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "%echo hi there\n"
     ]
    }
   ],
   "source": [
    "console.log(In[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "%echo hi there\n"
     ]
    }
   ],
   "source": [
    "console.log(_ih[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "last input:\n",
      "console.log(_ih[1])\n",
      "\n",
      "second to last input:\n",
      "console.log(In[1])\n",
      "\n",
      "input before that:\n",
      "console.log(In[0])\n"
     ]
    }
   ],
   "source": [
    "console.log(\"last input:\\n\" + _i)\n",
    "console.log(\"\\nsecond to last input:\\n\" + _ii)\n",
    "console.log(\"\\ninput before that:\\n\" + _iii)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Output Caching\n",
    "The previous three output values are stored in `_`, `__`, and `___`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "42"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "21 * 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'foo'"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"f\" + \"oo\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.5707963267948966"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Math.PI / 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "last output: 1.5707963267948966\n",
      "second to last output: foo\n",
      "output before that: 42\n"
     ]
    }
   ],
   "source": [
    "console.log(\"last output:\", _)\n",
    "console.log(\"second to last output:\", __)\n",
    "console.log(\"output before that:\", ___)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Cell Magic\n",
    "Cell magics do something special with the entire Jupyter cell. For example, this `%%script` cell magic turns the entire shell into a bash script."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "loop 0\n",
      "loop 1\n",
      "loop 2\n",
      "loop 3\n",
      "loop 4\n",
      "loop 5\n",
      "loop 6\n",
      "loop 7\n",
      "loop 8\n",
      "loop 9\n",
      "[ process 'bash /var/folders/6j/bk9lpc4n057831vsshxv0_j8t5f96f/T/tmp-70353-r7SYuxMya83I' exited with code 0 ]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%%script bash\n",
    "for ((i = 0; i < 10; i++)); do\n",
    "    echo \"loop $i\"\n",
    "done"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## %automagic\n",
    "When automagic is enabled, magics can be called without the leading `%`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "evalmachine.<anonymous>:2\n",
      "echo hi\n",
      "     ^^\n",
      "\n",
      "SyntaxError: Unexpected identifier\n",
      "    at new Script (vm.js:100:7)\n",
      "    at createScript (vm.js:267:10)\n",
      "    at runInThisContext (vm.js:315:10)\n",
      "    at runCode (/Users/ampower/Projects/personal/magicpatch/lib/interpreter.js:329:12)\n",
      "    at magicInterpreter (/Users/ampower/Projects/personal/magicpatch/lib/interpreter.js:205:17)\n",
      "    at Object.ijavascriptMonkeyPatch [as runInThisContext] (/Users/ampower/Projects/personal/magicpatch/lib/interpreter.js:67:20)\n",
      "    at run ([eval]:1054:15)\n",
      "    at onRunRequest ([eval]:888:18)\n",
      "    at onMessage ([eval]:848:13)\n",
      "    at process.emit (events.js:314:20)\n"
     ]
    }
   ],
   "source": [
    "// this shouldn't work: required syntax is %echo since %automagic is off\n",
    "echo hi"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Automagic is ON, % prefix IS NOT needed for line magics.\n",
      "hi\n"
     ]
    }
   ],
   "source": [
    "%automagic on\n",
    "echo hi"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Useful Magics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ loading /Users/ampower/Projects/personal/magicpatch/test/helpers/testModule ]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{ source: 'helpers/testModule.js', worked: true }"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%require ../test/helpers/testModule"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Available line magics:\n",
      "%addmagic %automagic %cat %cd %cp %dhist %dirs %echo %env %foo %hist %history %inspect %load %loadjs %loadpy %ls %lsmagic %mkdir %mv %name %notify %npm %pip %popd %pushd %pwd %quickref %report %require %rm %rmdir %sx %system %who %whos\n",
      "\n",
      "Available cell magics:\n",
      "%%script\n",
      "\n",
      "Automagic is ON, % prefix IS NOT needed for line magics.\n"
     ]
    }
   ],
   "source": [
    "%lsmagic"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Untitled.ipynb\n",
      "Untitled1.ipynb\n",
      "Untitled2.ipynb\n",
      "magicdemo.ipynb\n",
      "quickDemo.png\n",
      "[ process 'ls' exited with code 0 ]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%ls"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "bar\t dirListing\t myObj\t myOtherVar\t myVar\t n\t o\t sayMyName\t x\n"
     ]
    }
   ],
   "source": [
    "myVar = 3\n",
    "myOtherVar = \"bob\"\n",
    "myObj = {}\n",
    "%who"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " Variable     Type       Data/Info                \n",
      "----------------------------------------------------\n",
      " bar          function   function                 \n",
      " dirListing   Array      [ps: No user named 'x',] \n",
      " myObj        Object     {}                       \n",
      " myOtherVar   string     \"bob\"                    \n",
      " myVar        number     3                        \n",
      " n            string     \"bob\"                    \n",
      " o            Object     {beer}                   \n",
      " sayMyName    function   function                 \n",
      " x            number     42                       \n",
      "\n"
     ]
    }
   ],
   "source": [
    "%whos"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "$$ value:\n",
      "\n",
      "[Object: null prototype] {\n",
      "  async: [Function: bound async],\n",
      "  done: [Function: bound done],\n",
      "  sendResult: [Function: bound ],\n",
      "  sendError: [Function: bound ],\n",
      "  mime: [Function: bound ],\n",
      "  text: [Function: bound ],\n",
      "  html: [Function: bound ],\n",
      "  svg: [Function: bound ],\n",
      "  png: [Function: bound ],\n",
      "  jpeg: [Function: bound ],\n",
      "  json: [Function: bound ],\n",
      "  input: [Function: bound input],\n",
      "  display: [Function: bound createDisplay],\n",
      "  clear: [Function: bound clear]\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "%inspect -d 1 $$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "# IJavascript + magicpatch<br>\n",
       "An enhanced Interactive JavaScript - Quick Reference Card<br>\n",
       "================================================================<br>\n",
       "<br>\n",
       "%magic?, %magic??      : Get help, or more help for object (also works as ?%magic, %??magic).<br>\n",
       "<br>\n",
       "Magic functions are prefixed by % or %%, and typically take their argumentswithout parentheses, quotes or even commas for convenience.  Line magics take asingle % and cell magics are prefixed with two %%.<br>\n",
       "<br>\n",
       "The following magic functions are currently available:<br>\n",
       "<br>\n",
       "%%script:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;Run a cell via a shell command.<br>\n",
       "%addmagic:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;Adds a new `function` as a magic named `name`.<br>\n",
       "%automagic:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;Make magic functions callable without having to type the initial %.<br>\n",
       "%cat:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;No brief available.<br>\n",
       "%cd:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;Change the current working directory<br>\n",
       "%cp:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;Copy files.<br>\n",
       "%dhist:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;Print your history of visited directories.<br>\n",
       "%dirs:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;Return the current directory stack.<br>\n",
       "%echo:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;Write arguments to the standard output.<br>\n",
       "%env:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;Get, set, or list environment variables.<br>\n",
       "%foo:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;No brief available.<br>\n",
       "%hist:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;Print input history with most recent last.<br>\n",
       "%history:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;Print input history with most recent last.<br>\n",
       "%inspect:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;Prints out the properties of an object.<br>\n",
       "%load:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;Used to import modules, JSON, and local files.<br>\n",
       "%loadjs:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;Used to import modules, JSON, and local files.<br>\n",
       "%loadpy:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;No brief available.<br>\n",
       "%ls:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;No brief available.<br>\n",
       "%lsmagic:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;No brief available.<br>\n",
       "%mkdir:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;No brief available.<br>\n",
       "%mv:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;No brief available.<br>\n",
       "%name:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;No brief available.<br>\n",
       "%notify:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;Shows an OS-specific notification to the user.<br>\n",
       "%npm:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;brief description<br>\n",
       "%pip:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;No brief available.<br>\n",
       "%popd:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;Change to directory popped off the top of the stack.<br>\n",
       "%pushd:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;Place the current dir on stack and change directory.<br>\n",
       "%pwd:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;No brief available.<br>\n",
       "%quickref:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;No brief available.<br>\n",
       "%report:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;Prints a report of the system configuration for reproducibility purposes<br>\n",
       "%require:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;Used to import modules, JSON, and local files.<br>\n",
       "%rm:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;No brief available.<br>\n",
       "%rmdir:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;No brief available.<br>\n",
       "%sx:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;Shell execute - run shell command and capture output.<br>\n",
       "%system:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;Shell execute - run shell command and capture output.<br>\n",
       "%who:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;No brief available.<br>\n",
       "%whos:<br>\n",
       "&nbsp;&nbsp;&nbsp;&nbsp;No brief available.<br>\n"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%quickref"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "# Report\n",
       "__Report Created:__ Sunday, January 3, 2021, 12:37:16 PM PST<br>\n",
       "\n",
       "## System\n",
       "__OS:__ macOS High Sierra 10.13.6<br>\n",
       "__CPU:__ (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz<br>\n",
       "__Memory:__ 2.22 GB / 16.00 GB<br>\n",
       "__Shell:__ 3.2.57 (/bin/bash)<br>\n",
       "\n",
       "## Binaries\n",
       "__Node:__ 14.8.0 (/opt/local/bin/node)<br>\n",
       "__NPM:__ 6.14.10 (/opt/local/bin/npm)<br>\n",
       "__Yarn:__ Not Found<br>\n",
       "\n",
       "## Languages\n",
       "__Bash:__ 3.2.57 (/bin/bash)<br>\n",
       "__Go:__ Not Found<br>\n",
       "__Java:__ 11.0.5 (/usr/bin/javac)<br>\n",
       "__Perl:__ 5.26.3 (/opt/local/bin/perl)<br>\n",
       "__PHP:__ 7.1.33 (/usr/bin/php)<br>\n",
       "__Python:__ 3.7.8 (/opt/local/bin/python)<br>\n",
       "__Python3:__ 3.7.8 (/opt/local/bin/python3)<br>\n",
       "__R:__ Not Found<br>\n",
       "__Ruby:__ 2.3.7 (/usr/bin/ruby)<br>\n",
       "\n",
       "## Managers\n",
       "__pip2:__ Not Found<br>\n",
       "__pip3:__ not in version / path format<br>\n",
       "\n",
       "## Utilities\n",
       "__CMake:__ 3.18.2 (/opt/local/bin/cmake)<br>\n",
       "__Make:__ 3.81 (/usr/bin/make)<br>\n",
       "__GCC:__ 4.2.1 (/usr/bin/gcc)<br>\n",
       "__Git:__ 2.21.0 (/opt/local/bin/git)<br>\n",
       "__Clang:__ 1000.11.45.5 (/usr/bin/clang)<br>\n",
       "__Make:__ 3.81 (/usr/bin/make)<br>\n",
       "\n",
       "## Virtualization\n",
       "__Docker:__ Not Found<br>\n",
       "__Running In Docker:__ no<br>\n",
       "__Parallels:__ Not Found<br>\n",
       "__VirtualBox:__ 6.1.14 (/usr/local/bin/vboxmanage)<br>\n",
       "\n",
       "## Browsers\n",
       "__Brave:__ Not Found<br>\n",
       "__Chrome:__ 87.0.4280.88 (undefined)<br>\n",
       "__Chrome Canary:__ Not Found<br>\n",
       "__Edge:__ Not Found<br>\n",
       "__Firefox:__ 78.4.1 (undefined)<br>\n",
       "__Firefox Developer Edition:__ Not Found<br>\n",
       "__Firefox Nightly:__ Not Found<br>\n",
       "__Safari:__ 13.1.2 (undefined)<br>\n",
       "__Safari Technology Preview:__ Not Found<br>\n",
       "\n",
       "## Jupyter\n",
       "### Jupyter Packages\n",
       "__jupyter core:__ 4.6.2<br>\n",
       "__jupyter-notebook:__ 6.0.3<br>\n",
       "__qtconsole:__ 4.6.0<br>\n",
       "__ipython:__ 7.12.0<br>\n",
       "__ipykernel:__ 5.1.4<br>\n",
       "__jupyter client:__ 5.3.4<br>\n",
       "__jupyter lab:__ not installed<br>\n",
       "__nbconvert:__ 5.6.1<br>\n",
       "__ipywidgets:__ 7.5.1<br>\n",
       "__nbformat:__ 5.0.4<br>\n",
       "__traitlets:__ 4.3.3<br>\n",
       "### Jupyter Kernels\n",
       "__javascript:__ /Users/ampower/Library/Jupyter/kernels/javascript<br>\n",
       "__python3:__ /opt/local/Library/Frameworks/Python.framework/Versions/3.7/share/jupyter/kernels/python3<br>\n",
       "\n",
       "## Git\n",
       "__Git Directory:__ /Users/ampower/Projects/personal/magicpatch<br>\n",
       "__Branch:__ master<br>\n",
       "__Last Commit:__ b9a52ccb5913164c565bcf158fab637caf00feb6 (\"test delinting\")<br>\n",
       "__Parent:__ d0827e3b906eb90b9dd845ba93da792f9a156064<br>\n",
       "__Tree:__ 480c2f8367fc326d8fcc6120def92fecc1e13fc5<br>\n",
       "### Remotes\n",
       "* origin (https://github.com/apowers313/magicpatch.git)\n",
       "### Git Status\n",
       "* README.md: modified, unstaged\n",
       "* examples/magicdemo.ipynb: modified, unstaged\n",
       "\n",
       "## NPM ls\n",
       "<pre>\n",
       "magicpatch@0.10.1 /Users/ampower/Projects/personal/magicpatch\n",
       "├─┬ chai@4.2.0\n",
       "│ ├── assertion-error@1.1.0\n",
       "│ ├── check-error@1.0.2\n",
       "│ ├─┬ deep-eql@3.0.1\n",
       "│ │ └── type-detect@4.0.8 deduped\n",
       "│ ├── get-func-name@2.0.0\n",
       "│ ├── pathval@1.1.0\n",
       "│ └── type-detect@4.0.8\n",
       "├── chai-string@1.5.0\n",
       "├── commander@6.2.1\n",
       "├─┬ doctoc@2.0.0\n",
       "│ ├─┬ @textlint/markdown-to-ast@6.1.7\n",
       "│ │ ├── @textlint/ast-node-types@4.3.5\n",
       "│ │ ├── debug@4.2.0 deduped\n",
       "│ │ ├─┬ remark-frontmatter@1.3.3\n",
       "│ │ │ ├─┬ fault@1.0.4\n",
       "│ │ │ │ └── format@0.2.2\n",
       "│ │ │ └── xtend@4.0.2\n",
       "│ │ ├─┬ remark-parse@5.0.0\n",
       "│ │ │ ├── collapse-white-space@1.0.6\n",
       "│ │ │ ├── is-alphabetical@1.0.4\n",
       "│ │ │ ├── is-decimal@1.0.4\n",
       "│ │ │ ├── is-whitespace-character@1.0.4\n",
       "│ │ │ ├── is-word-character@1.0.4\n",
       "│ │ │ ├── markdown-escapes@1.0.4\n",
       "│ │ │ ├─┬ parse-entities@1.2.2\n",
       "│ │ │ │ ├── character-entities@1.2.4\n",
       "│ │ │ │ ├── character-entities-legacy@1.1.4\n",
       "│ │ │ │ ├── character-reference-invalid@1.1.4\n",
       "│ │ │ │ ├─┬ is-alphanumerical@1.0.4\n",
       "│ │ │ │ │ ├── is-alphabetical@1.0.4 deduped\n",
       "│ │ │ │ │ └── is-decimal@1.0.4 deduped\n",
       "│ │ │ │ ├── is-decimal@1.0.4 deduped\n",
       "│ │ │ │ └── is-hexadecimal@1.0.4\n",
       "│ │ │ ├── repeat-string@1.6.1\n",
       "│ │ │ ├── state-toggle@1.0.3\n",
       "│ │ │ ├── trim@0.0.1\n",
       "│ │ │ ├── trim-trailing-lines@1.1.4\n",
       "│ │ │ ├─┬ unherit@1.1.3\n",
       "│ │ │ │ ├── inherits@2.0.4 deduped\n",
       "│ │ │ │ └── xtend@4.0.2 deduped\n",
       "│ │ │ ├─┬ unist-util-remove-position@1.1.4\n",
       "│ │ │ │ └─┬ unist-util-visit@1.4.1\n",
       "│ │ │ │   └─┬ unist-util-visit-parents@2.1.2\n",
       "│ │ │ │     └── unist-util-is@3.0.0\n",
       "│ │ │ ├── vfile-location@2.0.6\n",
       "│ │ │ └── xtend@4.0.2 deduped\n",
       "│ │ ├─┬ structured-source@3.0.2\n",
       "│ │ │ └── boundary@1.0.1\n",
       "│ │ ├── traverse@0.6.6\n",
       "│ │ └─┬ unified@6.2.0\n",
       "│ │   ├── bail@1.0.5\n",
       "│ │   ├── extend@3.0.2\n",
       "│ │   ├── is-plain-obj@1.1.0\n",
       "│ │   ├── trough@1.0.5\n",
       "│ │   ├─┬ vfile@2.3.0\n",
       "│ │   │ ├── is-buffer@1.1.6\n",
       "│ │   │ ├── replace-ext@1.0.0\n",
       "│ │   │ ├── unist-util-stringify-position@1.1.2\n",
       "│ │   │ └─┬ vfile-message@1.1.1\n",
       "│ │   │   └── unist-util-stringify-position@1.1.2 deduped\n",
       "│ │   └── x-is-string@0.1.0\n",
       "│ ├─┬ anchor-markdown-header@0.5.7\n",
       "│ │ └── emoji-regex@6.1.3\n",
       "│ ├─┬ htmlparser2@4.1.0\n",
       "│ │ ├── domelementtype@2.1.0\n",
       "│ │ ├─┬ domhandler@3.3.0\n",
       "│ │ │ └── domelementtype@2.1.0 deduped\n",
       "│ │ ├─┬ domutils@2.4.4\n",
       "│ │ │ ├─┬ dom-serializer@1.2.0\n",
       "│ │ │ │ ├── domelementtype@2.1.0 deduped\n",
       "│ │ │ │ ├─┬ domhandler@4.0.0\n",
       "│ │ │ │ │ └── domelementtype@2.1.0 deduped\n",
       "│ │ │ │ └── entities@2.1.0 deduped\n",
       "│ │ │ ├── domelementtype@2.1.0 deduped\n",
       "│ │ │ └─┬ domhandler@4.0.0\n",
       "│ │ │   └── domelementtype@2.1.0 deduped\n",
       "│ │ └── entities@2.1.0\n",
       "│ ├── minimist@1.2.5\n",
       "│ ├── underscore@1.10.2\n",
       "│ └── update-section@0.3.3\n",
       "├── envinfo@7.7.3\n",
       "├─┬ eslint@7.16.0\n",
       "│ ├─┬ @babel/code-frame@7.12.11\n",
       "│ │ └─┬ @babel/highlight@7.10.4\n",
       "│ │   ├── @babel/helper-validator-identifier@7.12.11\n",
       "│ │   ├─┬ chalk@2.4.2\n",
       "│ │   │ ├─┬ ansi-styles@3.2.1\n",
       "│ │   │ │ └─┬ color-convert@1.9.3\n",
       "│ │   │ │   └── color-name@1.1.3\n",
       "│ │   │ ├── escape-string-regexp@1.0.5\n",
       "│ │   │ └─┬ supports-color@5.5.0\n",
       "│ │   │   └── has-flag@3.0.0\n",
       "│ │   └── js-tokens@4.0.0\n",
       "│ ├─┬ @eslint/eslintrc@0.2.2\n",
       "│ │ ├── ajv@6.12.6 deduped\n",
       "│ │ ├── debug@4.2.0 deduped\n",
       "│ │ ├── espree@7.3.1 deduped\n",
       "│ │ ├── globals@12.4.0 deduped\n",
       "│ │ ├── ignore@4.0.6 deduped\n",
       "│ │ ├── import-fresh@3.3.0 deduped\n",
       "│ │ ├── js-yaml@3.14.0 deduped\n",
       "│ │ ├── lodash@4.17.20 deduped\n",
       "│ │ ├── minimatch@3.0.4 deduped\n",
       "│ │ └── strip-json-comments@3.1.1 deduped\n",
       "│ ├─┬ ajv@6.12.6\n",
       "│ │ ├── fast-deep-equal@3.1.3\n",
       "│ │ ├── fast-json-stable-stringify@2.1.0\n",
       "│ │ ├── json-schema-traverse@0.4.1\n",
       "│ │ └─┬ uri-js@4.4.0\n",
       "│ │   └── punycode@2.1.1\n",
       "│ ├─┬ chalk@4.1.0\n",
       "│ │ ├─┬ ansi-styles@4.3.0\n",
       "│ │ │ └─┬ color-convert@2.0.1\n",
       "│ │ │   └── color-name@1.1.4\n",
       "│ │ └── supports-color@7.2.0 deduped\n",
       "│ ├─┬ cross-spawn@7.0.3\n",
       "│ │ ├── path-key@3.1.1\n",
       "│ │ ├─┬ shebang-command@2.0.0\n",
       "│ │ │ └── shebang-regex@3.0.0\n",
       "│ │ └── which@2.0.2 deduped\n",
       "│ ├─┬ debug@4.2.0\n",
       "│ │ └── ms@2.1.2 deduped\n",
       "│ ├─┬ doctrine@3.0.0\n",
       "│ │ └── esutils@2.0.3 deduped\n",
       "│ ├─┬ enquirer@2.3.6\n",
       "│ │ └── ansi-colors@4.1.1 deduped\n",
       "│ ├─┬ eslint-scope@5.1.1\n",
       "│ │ ├─┬ esrecurse@4.3.0\n",
       "│ │ │ └── estraverse@5.2.0\n",
       "│ │ └── estraverse@4.3.0\n",
       "│ ├─┬ eslint-utils@2.1.0\n",
       "│ │ └── eslint-visitor-keys@1.3.0\n",
       "│ ├── eslint-visitor-keys@2.0.0\n",
       "│ ├─┬ espree@7.3.1\n",
       "│ │ ├── acorn@7.4.1\n",
       "│ │ ├── acorn-jsx@5.3.1\n",
       "│ │ └── eslint-visitor-keys@1.3.0\n",
       "│ ├─┬ esquery@1.3.1\n",
       "│ │ └── estraverse@5.2.0\n",
       "│ ├── esutils@2.0.3\n",
       "│ ├─┬ file-entry-cache@6.0.0\n",
       "│ │ └─┬ flat-cache@3.0.4\n",
       "│ │   ├── flatted@3.1.0\n",
       "│ │   └── rimraf@3.0.2 deduped\n",
       "│ ├── functional-red-black-tree@1.0.1\n",
       "│ ├─┬ glob-parent@5.1.1\n",
       "│ │ └── is-glob@4.0.1 deduped\n",
       "│ ├─┬ globals@12.4.0\n",
       "│ │ └── type-fest@0.8.1\n",
       "│ ├── ignore@4.0.6\n",
       "│ ├─┬ import-fresh@3.3.0\n",
       "│ │ ├─┬ parent-module@1.0.1\n",
       "│ │ │ └── callsites@3.1.0\n",
       "│ │ └── resolve-from@4.0.0\n",
       "│ ├── imurmurhash@0.1.4\n",
       "│ ├─┬ is-glob@4.0.1\n",
       "│ │ └── is-extglob@2.1.1\n",
       "│ ├─┬ js-yaml@3.14.0\n",
       "│ │ ├─┬ argparse@1.0.10\n",
       "│ │ │ └── sprintf-js@1.0.3\n",
       "│ │ └── esprima@4.0.1\n",
       "│ ├── json-stable-stringify-without-jsonify@1.0.1\n",
       "│ ├─┬ levn@0.4.1\n",
       "│ │ ├── prelude-ls@1.2.1\n",
       "│ │ └─┬ type-check@0.4.0\n",
       "│ │   └── prelude-ls@1.2.1 deduped\n",
       "│ ├── lodash@4.17.20\n",
       "│ ├─┬ minimatch@3.0.4\n",
       "│ │ └─┬ brace-expansion@1.1.11\n",
       "│ │   ├── balanced-match@1.0.0\n",
       "│ │   └── concat-map@0.0.1\n",
       "│ ├── natural-compare@1.4.0\n",
       "│ ├─┬ optionator@0.9.1\n",
       "│ │ ├── deep-is@0.1.3\n",
       "│ │ ├── fast-levenshtein@2.0.6\n",
       "│ │ ├── levn@0.4.1 deduped\n",
       "│ │ ├── prelude-ls@1.2.1 deduped\n",
       "│ │ ├── type-check@0.4.0 deduped\n",
       "│ │ └── word-wrap@1.2.3\n",
       "│ ├── progress@2.0.3\n",
       "│ ├── regexpp@3.1.0\n",
       "│ ├─┬ semver@7.3.4\n",
       "│ │ └─┬ lru-cache@6.0.0\n",
       "│ │   └── yallist@4.0.0\n",
       "│ ├─┬ strip-ansi@6.0.0\n",
       "│ │ └── ansi-regex@5.0.0\n",
       "│ ├── strip-json-comments@3.1.1\n",
       "│ ├── table@6.0.4 deduped\n",
       "│ ├── text-table@0.2.0\n",
       "│ └── v8-compile-cache@2.2.0\n",
       "├─┬ eslint-plugin-jsdoc@30.7.9\n",
       "│ ├── comment-parser@0.7.6\n",
       "│ ├─┬ debug@4.3.1\n",
       "│ │ └── ms@2.1.2 deduped\n",
       "│ ├── jsdoctypeparser@9.0.0\n",
       "│ ├── lodash@4.17.20 deduped\n",
       "│ ├── regextras@0.7.1\n",
       "│ ├── semver@7.3.4 deduped\n",
       "│ └─┬ spdx-expression-parse@3.0.1\n",
       "│   ├── spdx-exceptions@2.3.0\n",
       "│   └── spdx-license-ids@3.0.7\n",
       "├─┬ eslint-plugin-mocha@8.0.0\n",
       "│ ├── eslint-utils@2.1.0 deduped\n",
       "│ └── ramda@0.27.1\n",
       "├── eslint-plugin-old-c-programmer@1.0.1\n",
       "├─┬ humanize-anything@1.1.1\n",
       "│ └── @jsdevtools/humanize-anything@1.1.1\n",
       "├── is-docker@2.1.1\n",
       "├─┬ isomorphic-git@1.8.0\n",
       "│ ├── async-lock@1.2.6\n",
       "│ ├── clean-git-ref@2.0.1\n",
       "│ ├─┬ crc-32@1.2.0\n",
       "│ │ ├── exit-on-epipe@1.0.1\n",
       "│ │ └── printj@1.1.2\n",
       "│ ├── diff3@0.0.3\n",
       "│ ├── ignore@5.1.8\n",
       "│ ├─┬ minimisted@2.0.1\n",
       "│ │ └── minimist@1.2.5 deduped\n",
       "│ ├── pako@1.0.11\n",
       "│ ├── pify@4.0.1\n",
       "│ ├─┬ readable-stream@3.6.0\n",
       "│ │ ├── inherits@2.0.4\n",
       "│ │ ├─┬ string_decoder@1.3.0\n",
       "│ │ │ └── safe-buffer@5.2.1 deduped\n",
       "│ │ └── util-deprecate@1.0.2\n",
       "│ ├─┬ sha.js@2.4.11\n",
       "│ │ ├── inherits@2.0.4 deduped\n",
       "│ │ └── safe-buffer@5.2.1\n",
       "│ └─┬ simple-get@3.1.0\n",
       "│   ├─┬ decompress-response@4.2.1\n",
       "│   │ └── mimic-response@2.1.0\n",
       "│   ├─┬ once@1.4.0\n",
       "│   │ └── wrappy@1.0.2\n",
       "│   └── simple-concat@1.0.1\n",
       "├─┬ mocha@8.2.1\n",
       "│ ├── @ungap/promise-all-settled@1.1.2\n",
       "│ ├── ansi-colors@4.1.1\n",
       "│ ├── browser-stdout@1.3.1\n",
       "│ ├─┬ chokidar@3.4.3\n",
       "│ │ ├─┬ anymatch@3.1.1\n",
       "│ │ │ ├── normalize-path@3.0.0 deduped\n",
       "│ │ │ └── picomatch@2.2.2\n",
       "│ │ ├─┬ braces@3.0.2\n",
       "│ │ │ └─┬ fill-range@7.0.1\n",
       "│ │ │   └─┬ to-regex-range@5.0.1\n",
       "│ │ │     └── is-number@7.0.0\n",
       "│ │ ├── fsevents@2.1.3\n",
       "│ │ ├── glob-parent@5.1.1 deduped\n",
       "│ │ ├─┬ is-binary-path@2.1.0\n",
       "│ │ │ └── binary-extensions@2.1.0\n",
       "│ │ ├── is-glob@4.0.1 deduped\n",
       "│ │ ├── normalize-path@3.0.0\n",
       "│ │ └─┬ readdirp@3.5.0\n",
       "│ │   └── picomatch@2.2.2 deduped\n",
       "│ ├── debug@4.2.0 deduped\n",
       "│ ├── diff@4.0.2\n",
       "│ ├── escape-string-regexp@4.0.0\n",
       "│ ├─┬ find-up@5.0.0\n",
       "│ │ ├─┬ locate-path@6.0.0\n",
       "│ │ │ └─┬ p-locate@5.0.0\n",
       "│ │ │   └─┬ p-limit@3.1.0\n",
       "│ │ │     └── yocto-queue@0.1.0\n",
       "│ │ └── path-exists@4.0.0\n",
       "│ ├─┬ glob@7.1.6\n",
       "│ │ ├── fs.realpath@1.0.0\n",
       "│ │ ├─┬ inflight@1.0.6\n",
       "│ │ │ ├── once@1.4.0 deduped\n",
       "│ │ │ └── wrappy@1.0.2 deduped\n",
       "│ │ ├── inherits@2.0.4 deduped\n",
       "│ │ ├── minimatch@3.0.4 deduped\n",
       "│ │ ├── once@1.4.0 deduped\n",
       "│ │ └── path-is-absolute@1.0.1\n",
       "│ ├── growl@1.10.5\n",
       "│ ├── he@1.2.0\n",
       "│ ├── js-yaml@3.14.0 deduped\n",
       "│ ├─┬ log-symbols@4.0.0\n",
       "│ │ └── chalk@4.1.0 deduped\n",
       "│ ├── minimatch@3.0.4 deduped\n",
       "│ ├── ms@2.1.2\n",
       "│ ├── nanoid@3.1.12\n",
       "│ ├─┬ serialize-javascript@5.0.1\n",
       "│ │ └─┬ randombytes@2.1.0\n",
       "│ │   └── safe-buffer@5.2.1 deduped\n",
       "│ ├── strip-json-comments@3.1.1 deduped\n",
       "│ ├─┬ supports-color@7.2.0\n",
       "│ │ └── has-flag@4.0.0\n",
       "│ ├─┬ which@2.0.2\n",
       "│ │ └── isexe@2.0.0\n",
       "│ ├─┬ wide-align@1.1.3\n",
       "│ │ └─┬ string-width@2.1.1\n",
       "│ │   ├── is-fullwidth-code-point@2.0.0\n",
       "│ │   └─┬ strip-ansi@4.0.0\n",
       "│ │     └── ansi-regex@3.0.0\n",
       "│ ├── workerpool@6.0.2\n",
       "│ ├─┬ yargs@13.3.2\n",
       "│ │ ├─┬ cliui@5.0.0\n",
       "│ │ │ ├─┬ string-width@3.1.0\n",
       "│ │ │ │ ├── emoji-regex@7.0.3 deduped\n",
       "│ │ │ │ ├── is-fullwidth-code-point@2.0.0 deduped\n",
       "│ │ │ │ └── strip-ansi@5.2.0 deduped\n",
       "│ │ │ ├─┬ strip-ansi@5.2.0\n",
       "│ │ │ │ └── ansi-regex@4.1.0\n",
       "│ │ │ └─┬ wrap-ansi@5.1.0\n",
       "│ │ │   ├─┬ ansi-styles@3.2.1\n",
       "│ │ │   │ └─┬ color-convert@1.9.3\n",
       "│ │ │   │   └── color-name@1.1.3\n",
       "│ │ │   ├─┬ string-width@3.1.0\n",
       "│ │ │   │ ├── emoji-regex@7.0.3 deduped\n",
       "│ │ │   │ ├── is-fullwidth-code-point@2.0.0 deduped\n",
       "│ │ │   │ └── strip-ansi@5.2.0 deduped\n",
       "│ │ │   └─┬ strip-ansi@5.2.0\n",
       "│ │ │     └── ansi-regex@4.1.0\n",
       "│ │ ├─┬ find-up@3.0.0\n",
       "│ │ │ └─┬ locate-path@3.0.0\n",
       "│ │ │   ├─┬ p-locate@3.0.0\n",
       "│ │ │   │ └─┬ p-limit@2.3.0\n",
       "│ │ │   │   └── p-try@2.2.0 deduped\n",
       "│ │ │   └── path-exists@3.0.0\n",
       "│ │ ├── get-caller-file@2.0.5\n",
       "│ │ ├── require-directory@2.1.1\n",
       "│ │ ├── require-main-filename@2.0.0\n",
       "│ │ ├── set-blocking@2.0.0\n",
       "│ │ ├─┬ string-width@3.1.0\n",
       "│ │ │ ├── emoji-regex@7.0.3\n",
       "│ │ │ ├── is-fullwidth-code-point@2.0.0 deduped\n",
       "│ │ │ └─┬ strip-ansi@5.2.0\n",
       "│ │ │   └── ansi-regex@4.1.0\n",
       "│ │ ├── which-module@2.0.0\n",
       "│ │ ├── y18n@4.0.1\n",
       "│ │ └── yargs-parser@13.1.2 deduped\n",
       "│ ├─┬ yargs-parser@13.1.2\n",
       "│ │ ├── camelcase@5.3.1\n",
       "│ │ └── decamelize@1.2.0 deduped\n",
       "│ └─┬ yargs-unparser@2.0.0\n",
       "│   ├── camelcase@6.2.0\n",
       "│   ├── decamelize@4.0.0\n",
       "│   ├── flat@5.0.2\n",
       "│   └── is-plain-obj@2.1.0\n",
       "├─┬ mock-spawn@0.2.6\n",
       "│ └── through@2.3.8\n",
       "├── mockery@2.1.0\n",
       "├─┬ node-notifier@9.0.0\n",
       "│ ├── growly@1.3.0\n",
       "│ ├─┬ is-wsl@2.2.0\n",
       "│ │ └── is-docker@2.1.1 deduped\n",
       "│ ├── semver@7.3.4 deduped\n",
       "│ ├── shellwords@0.1.1\n",
       "│ ├── uuid@8.3.2\n",
       "│ └── which@2.0.2 deduped\n",
       "├─┬ nyc@15.1.0\n",
       "│ ├─┬ @istanbuljs/load-nyc-config@1.1.0\n",
       "│ │ ├── camelcase@5.3.1 deduped\n",
       "│ │ ├─┬ find-up@4.1.0\n",
       "│ │ │ ├─┬ locate-path@5.0.0\n",
       "│ │ │ │ └─┬ p-locate@4.1.0\n",
       "│ │ │ │   └─┬ p-limit@2.3.0\n",
       "│ │ │ │     └── p-try@2.2.0 deduped\n",
       "│ │ │ └── path-exists@4.0.0 deduped\n",
       "│ │ ├── get-package-type@0.1.0 deduped\n",
       "│ │ ├── js-yaml@3.14.0 deduped\n",
       "│ │ └── resolve-from@5.0.0\n",
       "│ ├── @istanbuljs/schema@0.1.2\n",
       "│ ├─┬ caching-transform@4.0.0\n",
       "│ │ ├─┬ hasha@5.2.2\n",
       "│ │ │ ├── is-stream@2.0.0\n",
       "│ │ │ └── type-fest@0.8.1 deduped\n",
       "│ │ ├── make-dir@3.1.0 deduped\n",
       "│ │ ├─┬ package-hash@4.0.0\n",
       "│ │ │ ├── graceful-fs@4.2.4\n",
       "│ │ │ ├── hasha@5.2.2 deduped\n",
       "│ │ │ ├── lodash.flattendeep@4.4.0\n",
       "│ │ │ └─┬ release-zalgo@1.0.0\n",
       "│ │ │   └── es6-error@4.1.1\n",
       "│ │ └─┬ write-file-atomic@3.0.3\n",
       "│ │   ├── imurmurhash@0.1.4 deduped\n",
       "│ │   ├── is-typedarray@1.0.0\n",
       "│ │   ├── signal-exit@3.0.3 deduped\n",
       "│ │   └─┬ typedarray-to-buffer@3.1.5\n",
       "│ │     └── is-typedarray@1.0.0 deduped\n",
       "│ ├─┬ convert-source-map@1.7.0\n",
       "│ │ └── safe-buffer@5.1.2\n",
       "│ ├── decamelize@1.2.0\n",
       "│ ├─┬ find-cache-dir@3.3.1\n",
       "│ │ ├── commondir@1.0.1\n",
       "│ │ ├── make-dir@3.1.0 deduped\n",
       "│ │ └─┬ pkg-dir@4.2.0\n",
       "│ │   └─┬ find-up@4.1.0\n",
       "│ │     ├─┬ locate-path@5.0.0\n",
       "│ │     │ └─┬ p-locate@4.1.0\n",
       "│ │     │   └─┬ p-limit@2.3.0\n",
       "│ │     │     └── p-try@2.2.0 deduped\n",
       "│ │     └── path-exists@4.0.0 deduped\n",
       "│ ├─┬ find-up@4.1.0\n",
       "│ │ ├─┬ locate-path@5.0.0\n",
       "│ │ │ └─┬ p-locate@4.1.0\n",
       "│ │ │   └─┬ p-limit@2.3.0\n",
       "│ │ │     └── p-try@2.2.0\n",
       "│ │ └── path-exists@4.0.0 deduped\n",
       "│ ├─┬ foreground-child@2.0.0\n",
       "│ │ ├── cross-spawn@7.0.3 deduped\n",
       "│ │ └── signal-exit@3.0.3 deduped\n",
       "│ ├── get-package-type@0.1.0\n",
       "│ ├── glob@7.1.6 deduped\n",
       "│ ├── istanbul-lib-coverage@3.0.0\n",
       "│ ├─┬ istanbul-lib-hook@3.0.0\n",
       "│ │ └─┬ append-transform@2.0.0\n",
       "│ │   └─┬ default-require-extensions@3.0.0\n",
       "│ │     └── strip-bom@4.0.0\n",
       "│ ├─┬ istanbul-lib-instrument@4.0.3\n",
       "│ │ ├─┬ @babel/core@7.12.10\n",
       "│ │ │ ├── @babel/code-frame@7.12.11 deduped\n",
       "│ │ │ ├─┬ @babel/generator@7.12.11\n",
       "│ │ │ │ ├── @babel/types@7.12.12 deduped\n",
       "│ │ │ │ ├── jsesc@2.5.2\n",
       "│ │ │ │ └── source-map@0.5.7 deduped\n",
       "│ │ │ ├─┬ @babel/helper-module-transforms@7.12.1\n",
       "│ │ │ │ ├─┬ @babel/helper-module-imports@7.12.5\n",
       "│ │ │ │ │ └── @babel/types@7.12.12 deduped\n",
       "│ │ │ │ ├─┬ @babel/helper-replace-supers@7.12.11\n",
       "│ │ │ │ │ ├─┬ @babel/helper-member-expression-to-functions@7.12.7\n",
       "│ │ │ │ │ │ └── @babel/types@7.12.12 deduped\n",
       "│ │ │ │ │ ├─┬ @babel/helper-optimise-call-expression@7.12.10\n",
       "│ │ │ │ │ │ └── @babel/types@7.12.12 deduped\n",
       "│ │ │ │ │ ├── @babel/traverse@7.12.12 deduped\n",
       "│ │ │ │ │ └── @babel/types@7.12.12 deduped\n",
       "│ │ │ │ ├─┬ @babel/helper-simple-access@7.12.1\n",
       "│ │ │ │ │ └── @babel/types@7.12.12 deduped\n",
       "│ │ │ │ ├─┬ @babel/helper-split-export-declaration@7.12.11\n",
       "│ │ │ │ │ └── @babel/types@7.12.12 deduped\n",
       "│ │ │ │ ├── @babel/helper-validator-identifier@7.12.11 deduped\n",
       "│ │ │ │ ├── @babel/template@7.12.7 deduped\n",
       "│ │ │ │ ├── @babel/traverse@7.12.12 deduped\n",
       "│ │ │ │ ├── @babel/types@7.12.12 deduped\n",
       "│ │ │ │ └── lodash@4.17.20 deduped\n",
       "│ │ │ ├─┬ @babel/helpers@7.12.5\n",
       "│ │ │ │ ├── @babel/template@7.12.7 deduped\n",
       "│ │ │ │ ├── @babel/traverse@7.12.12 deduped\n",
       "│ │ │ │ └── @babel/types@7.12.12 deduped\n",
       "│ │ │ ├── @babel/parser@7.12.11\n",
       "│ │ │ ├─┬ @babel/template@7.12.7\n",
       "│ │ │ │ ├── @babel/code-frame@7.12.11 deduped\n",
       "│ │ │ │ ├── @babel/parser@7.12.11 deduped\n",
       "│ │ │ │ └── @babel/types@7.12.12 deduped\n",
       "│ │ │ ├─┬ @babel/traverse@7.12.12\n",
       "│ │ │ │ ├── @babel/code-frame@7.12.11 deduped\n",
       "│ │ │ │ ├── @babel/generator@7.12.11 deduped\n",
       "│ │ │ │ ├─┬ @babel/helper-function-name@7.12.11\n",
       "│ │ │ │ │ ├─┬ @babel/helper-get-function-arity@7.12.10\n",
       "│ │ │ │ │ │ └── @babel/types@7.12.12 deduped\n",
       "│ │ │ │ │ ├── @babel/template@7.12.7 deduped\n",
       "│ │ │ │ │ └── @babel/types@7.12.12 deduped\n",
       "│ │ │ │ ├── @babel/helper-split-export-declaration@7.12.11 deduped\n",
       "│ │ │ │ ├── @babel/parser@7.12.11 deduped\n",
       "│ │ │ │ ├── @babel/types@7.12.12 deduped\n",
       "│ │ │ │ ├── debug@4.2.0 deduped\n",
       "│ │ │ │ ├── globals@11.12.0\n",
       "│ │ │ │ └── lodash@4.17.20 deduped\n",
       "│ │ │ ├─┬ @babel/types@7.12.12\n",
       "│ │ │ │ ├── @babel/helper-validator-identifier@7.12.11 deduped\n",
       "│ │ │ │ ├── lodash@4.17.20 deduped\n",
       "│ │ │ │ └── to-fast-properties@2.0.0\n",
       "│ │ │ ├── convert-source-map@1.7.0 deduped\n",
       "│ │ │ ├── debug@4.2.0 deduped\n",
       "│ │ │ ├── gensync@1.0.0-beta.2\n",
       "│ │ │ ├─┬ json5@2.1.3\n",
       "│ │ │ │ └── minimist@1.2.5 deduped\n",
       "│ │ │ ├── lodash@4.17.20 deduped\n",
       "│ │ │ ├── semver@5.7.1\n",
       "│ │ │ └── source-map@0.5.7\n",
       "│ │ ├── @istanbuljs/schema@0.1.2 deduped\n",
       "│ │ ├── istanbul-lib-coverage@3.0.0 deduped\n",
       "│ │ └── semver@6.3.0\n",
       "│ ├─┬ istanbul-lib-processinfo@2.0.2\n",
       "│ │ ├── archy@1.0.0\n",
       "│ │ ├── cross-spawn@7.0.3 deduped\n",
       "│ │ ├── istanbul-lib-coverage@3.0.0 deduped\n",
       "│ │ ├── make-dir@3.1.0 deduped\n",
       "│ │ ├── p-map@3.0.0 deduped\n",
       "│ │ ├── rimraf@3.0.2 deduped\n",
       "│ │ └── uuid@3.4.0\n",
       "│ ├─┬ istanbul-lib-report@3.0.0\n",
       "│ │ ├── istanbul-lib-coverage@3.0.0 deduped\n",
       "│ │ ├── make-dir@3.1.0 deduped\n",
       "│ │ └── supports-color@7.2.0 deduped\n",
       "│ ├─┬ istanbul-lib-source-maps@4.0.0\n",
       "│ │ ├── debug@4.2.0 deduped\n",
       "│ │ ├── istanbul-lib-coverage@3.0.0 deduped\n",
       "│ │ └── source-map@0.6.1\n",
       "│ ├─┬ istanbul-reports@3.0.2\n",
       "│ │ ├── html-escaper@2.0.2\n",
       "│ │ └── istanbul-lib-report@3.0.0 deduped\n",
       "│ ├─┬ make-dir@3.1.0\n",
       "│ │ └── semver@6.3.0\n",
       "│ ├─┬ node-preload@0.2.1\n",
       "│ │ └── process-on-spawn@1.0.0 deduped\n",
       "│ ├─┬ p-map@3.0.0\n",
       "│ │ └─┬ aggregate-error@3.1.0\n",
       "│ │   ├── clean-stack@2.2.0\n",
       "│ │   └── indent-string@4.0.0\n",
       "│ ├─┬ process-on-spawn@1.0.0\n",
       "│ │ └── fromentries@1.3.2\n",
       "│ ├── resolve-from@5.0.0\n",
       "│ ├─┬ rimraf@3.0.2\n",
       "│ │ └── glob@7.1.6 deduped\n",
       "│ ├── signal-exit@3.0.3\n",
       "│ ├─┬ spawn-wrap@2.0.0\n",
       "│ │ ├── foreground-child@2.0.0 deduped\n",
       "│ │ ├── is-windows@1.0.2\n",
       "│ │ ├── make-dir@3.1.0 deduped\n",
       "│ │ ├── rimraf@3.0.2 deduped\n",
       "│ │ ├── signal-exit@3.0.3 deduped\n",
       "│ │ └── which@2.0.2 deduped\n",
       "│ ├─┬ test-exclude@6.0.0\n",
       "│ │ ├── @istanbuljs/schema@0.1.2 deduped\n",
       "│ │ ├── glob@7.1.6 deduped\n",
       "│ │ └── minimatch@3.0.4 deduped\n",
       "│ └─┬ yargs@15.4.1\n",
       "│   ├─┬ cliui@6.0.0\n",
       "│   │ ├── string-width@4.2.0 deduped\n",
       "│   │ ├─┬ strip-ansi@6.0.0\n",
       "│   │ │ └── ansi-regex@5.0.0\n",
       "│   │ └─┬ wrap-ansi@6.2.0\n",
       "│   │   ├── ansi-styles@4.3.0 deduped\n",
       "│   │   ├── string-width@4.2.0 deduped\n",
       "│   │   └── strip-ansi@6.0.0 deduped\n",
       "│   ├── decamelize@1.2.0 deduped\n",
       "│   ├── find-up@4.1.0 deduped\n",
       "│   ├── get-caller-file@2.0.5 deduped\n",
       "│   ├── require-directory@2.1.1 deduped\n",
       "│   ├── require-main-filename@2.0.0 deduped\n",
       "│   ├── set-blocking@2.0.0 deduped\n",
       "│   ├─┬ string-width@4.2.0\n",
       "│   │ ├── emoji-regex@8.0.0\n",
       "│   │ ├── is-fullwidth-code-point@3.0.0\n",
       "│   │ └── strip-ansi@6.0.0 deduped\n",
       "│   ├── which-module@2.0.0 deduped\n",
       "│   ├── y18n@4.0.1 deduped\n",
       "│   └─┬ yargs-parser@18.1.3\n",
       "│     ├── camelcase@5.3.1 deduped\n",
       "│     └── decamelize@1.2.0 deduped\n",
       "├─┬ std-mocks@1.0.1\n",
       "│ └── lodash@4.17.20 deduped\n",
       "├─┬ table@6.0.4\n",
       "│ ├── ajv@6.12.6 deduped\n",
       "│ ├── lodash@4.17.20 deduped\n",
       "│ ├─┬ slice-ansi@4.0.0\n",
       "│ │ ├── ansi-styles@4.3.0 deduped\n",
       "│ │ ├── astral-regex@2.0.0\n",
       "│ │ └── is-fullwidth-code-point@3.0.0\n",
       "│ └─┬ string-width@4.2.0\n",
       "│   ├── emoji-regex@8.0.0\n",
       "│   ├── is-fullwidth-code-point@3.0.0\n",
       "│   └─┬ strip-ansi@6.0.0\n",
       "│     └── ansi-regex@5.0.0\n",
       "└─┬ tmp@0.2.1\n",
       "  └── rimraf@3.0.2 deduped\n",
       "\n",
       "\n",
       "</pre>\n"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%report"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "    0: \n",
      "var n = \"bob\";\n",
      "console.log(\"hi\", n);\n",
      "    1: %echo hi there\n",
      "    2: \n",
      "function bar() {\n",
      "    console.log(\"LETS ALL GO TO THE BAR\");\n",
      "}\n",
      "%addmagic %foo bar\n",
      "    3: %foo\n",
      "    4: \n",
      "function sayMyName(cmd, name) {\n",
      "    console.log(\"my name is:\", name);\n",
      "}\n",
      "    5: %addmagic %name sayMyName\n",
      "    6: %name mud\n",
      "    7: !ls -laoF\n",
      "    8: ! ls\n",
      "    9: !npm audit\n",
      "    10: let mod = %require ../test/helpers/testModule.js\n",
      "    11: console.log(\"Module is:\", mod);\n",
      "    12: \n",
      "dirListing = %sx ps -aux\n",
      "console.log(\"local directory:\", dirListing)\n",
      "    13: \n",
      "x = 42\n",
      "%echo {x}\n",
      "    14: \n",
      "o = {\n",
      "    beer: \"yum\"\n",
      "}\n",
      "%echo {o}\n",
      "    15: %echo x{x}o{o}\n",
      "    16: ?%echo\n",
      "    17: %echo?\n",
      "    18: ??%echo\n",
      "    19: %echo??\n",
      "    20: console.log(In[0])\n",
      "    21: console.log(In[1])\n",
      "    22: console.log(_ih[1])\n",
      "    23: \n",
      "console.log(\"last input:\\n\" + _i)\n",
      "console.log(\"\\nsecond to last input:\\n\" + _ii)\n",
      "console.log(\"\\ninput before that:\\n\" + _iii)\n",
      "    24: 21 * 2\n",
      "    25: \"f\" + \"oo\"\n",
      "    26: Math.PI / 2\n",
      "    27: \n",
      "console.log(\"last output:\", _)\n",
      "console.log(\"second to last output:\", __)\n",
      "console.log(\"output before that:\", ___)\n",
      "    28: \n",
      "%%script bash\n",
      "for ((i = 0; i < 10; i++)); do\n",
      "    echo \"loop $i\"\n",
      "done\n",
      "    29: \n",
      "// this shouldn't work: required syntax is %echo since %automagic is off\n",
      "echo hi\n",
      "    30: \n",
      "%automagic on\n",
      "echo hi\n",
      "    31: %require ../test/helpers/testModule\n",
      "    32: %lsmagic\n",
      "    33: %ls\n",
      "    34: \n",
      "myVar = 3\n",
      "myOtherVar = \"bob\"\n",
      "myObj = {}\n",
      "%who\n",
      "    35: %whos\n",
      "    36: %inspect -d 1 $$\n",
      "    37: %quickref\n",
      "    38: %report\n",
      "\n"
     ]
    }
   ],
   "source": [
    "%history -n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Javascript (Node.js)",
   "language": "javascript",
   "name": "javascript"
  },
  "language_info": {
   "file_extension": ".js",
   "mimetype": "application/javascript",
   "name": "javascript",
   "version": "14.8.0"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "336px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
