{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": [],
      "toc_visible": true
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    },
    "gpuClass": "standard"
  },
  "cells": [
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "id": "XsmvnTbD9HYl",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "executionInfo": {
          "status": "ok",
          "timestamp": 1673711917680,
          "user_tz": 540,
          "elapsed": 20564,
          "user": {
            "displayName": "Jaci ss",
            "userId": "10130648813270993501"
          }
        },
        "outputId": "3bd02465-b2b8-4948-c84b-587b75cb30ff"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "2023-01-14 15:58:17 INFO     epc config may be overridden by `c[setting_name]`\n",
            "2023-01-14 06:58:17 INFO     log_level: DEBUG\n",
            "2023-01-14 06:58:17 INFO     timezone: America/Anchorage\n",
            "2023-01-14 06:58:17 INFO     use_google_drive: False\n",
            "2023-01-14 06:58:17 INFO     epc: U2FsdGVkX1+ShJhgVb/247GaHNsoV03UAGyM7NJpwUmuF9odJf1idbEivOH2WWeqLvMfx0XyiqpVD3DfC30Ke/ko2WGeDOV8+EOcVQUUGmJf6C6QLHai8ZQAOykiGfPdeTnbIPMYXrmRA3u0TwTnYxwn0jyh33Tr4vfPm9NEi6TGQ4C2FZ6IJgmLaCJRXmd/qIlA/RkNAxPNtkVIWoPEHnuEn/hov0C4DX0olEk8Uiv8q1w/bXuFDKiH/8GgiZ55X+w2zi3SVciA7bIKxbT+0icwjXah0P5E0EJhAd5Csmgi+M+D3FVUpaU3t9Z/dgGGvcGZs43oYlpBN08YNetneJr+pzsbg1BeDtySZu1f+9xLKvynC6ISPiQCLK1xp8KjV1veklEFH77RUzieB0CfiySvRIAl0V7+onwGKCNG3FYWVRsciwezB1KIp0OiSSxktFWxTUylF3rSAD3vw7Xgh5g6QJ/v8FI5Fd2HDixiV66Gx2DBIJdprJ68rwEK+8czk6U9nKEnnv08dp559Oex7PuM0IObz0zWcR1uS1oELvZsTVAnlM+uTjF2zMVm4pdae+JkgIRFMm8Lwunjbx/rfXKSv4tSd0ZvPDlwHOwBsI68UT5NHajMrO1GwWh9p57vPwlFO2k+/CpmUqJ7eYSL8g==\n",
            "2023-01-14 06:58:17 INFO     github: ['jai']\n",
            "2023-01-14 06:58:17 INFO     projects_dir: /content/\n",
            "2023-01-14 06:58:17 INFO     nb_dir: /content/jai/notebooks/\n",
            "2023-01-14 06:58:17 INFO     jai already in /content/\n",
            "2023-01-14 06:58:17 DEBUG    Starting new HTTP connection (1): 172.28.0.2:9000\n",
            "2023-01-14 06:58:17 DEBUG    http://172.28.0.2:9000 \"GET /api/sessions HTTP/1.1\" 200 418\n",
            "2023-01-14 06:58:17 INFO     /content/jai/notebooks/demo_notebook --> /content/jai/notebooks/git_for_colab\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "source notebook demo_notebook\n",
            "run_nb( git_for_colab ) nb_name: demo_notebook current running_nb set to: demo_notebook\n",
            "running: git_for_colab\n",
            "Save pass __variable, leave blank to enter each time: \u00b7\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7\n",
            "Overwriting /root/.jupyter/nbdime_config.json\n",
            "repo indices: {0: 'jai'}\n",
            "repo: jai\n",
            "-rw-r--r-- 1 root root  8259 Jan 14 06:58 demo_notebook.ipynb\n",
            "\n",
            " notebooks/demo_notebook.ipynb | 281 \u001b[32m+++++++++\u001b[m\u001b[31m---------------------------------\u001b[m\n",
            " 1 file changed, 57 insertions(+), 224 deletions(-)\n",
            "\u001b[0m\n",
            "\n",
            "nbdiff /tmp/9E9yKX_demo_notebook.ipynb notebooks/demo_notebook.ipynb\n",
            "--- /tmp/9E9yKX_demo_notebook.ipynb  2023-01-14 06:58:24.716134\n",
            "+++ notebooks/demo_notebook.ipynb  2023-01-14 06:58:24.560122\n",
            "\u001b[34m## deleted /cells/0:\u001b[0m\n",
            "\u001b[31m-  code cell:\n",
            "\u001b[31m-    execution_count: 6\n",
            "\u001b[31m-    metadata (unknown keys):\n",
            "\u001b[31m-      colab:\n",
            "\u001b[31m-        base_uri: https://localhost:8080/\n",
            "\u001b[31m-      executionInfo:\n",
            "\u001b[31m-        elapsed: 581\n",
            "\u001b[31m-        status: ok\n",
            "\u001b[31m-        timestamp: 1673705664634\n",
            "\u001b[31m-        user:\n",
            "\u001b[31m-          displayName: Jaci ss\n",
            "\u001b[31m-          userId: 10130648813270993501\n",
            "\u001b[31m-        user_tz: 540\n",
            "\u001b[31m-      id: bxnD-rPdt-5O\n",
            "\u001b[31m-      outputId: f29b8718-71ba-46ff-853e-90e91ea435da\n",
            "\u001b[31m-    source:\n",
            "\u001b[31m-      # !cd jai && git pull\n",
            "\u001b[31m-    outputs:\n",
            "\u001b[31m-      output 0:\n",
            "\u001b[31m-        output_type: stream\n",
            "\u001b[31m-        name: stdout\n",
            "\u001b[31m-        text:\n",
            "\u001b[31m-          Already up to date.\n",
            "\n",
            "\u001b[0m\u001b[34m## modified /cells/3/source:\u001b[0m\n",
            "\u001b[31m-  epc.decode(c['epc']).keys()\n",
            "\u001b[32m+  # epc.decode(c['epc']).keys()\n",
            "\n",
            "\u001b[0m\u001b[34m## modified /cells/4/source:\u001b[0m\n",
            "\u001b[36m@@ -1,2 +1,2 @@\u001b[m\n",
            " # %macro\u001b[m\n",
            "\u001b[31m-%hist\u001b[m\n",
            "\u001b[m\n",
            "\u001b[32m+\u001b[m\u001b[32m# %hist\u001b[m\n",
            "\u001b[m\n",
            "\n",
            "\u001b[0m\u001b[34m## modified /cells/6/source:\u001b[0m\n",
            "\u001b[36m@@ -1,7 +1,7 @@\u001b[m\n",
            " def config_dict():\u001b[m\n",
            "\u001b[31m-    # @title Test Form\u001b[m\n",
            "\u001b[31m-    Name = 'John Doe'    # @param {type: \"string\"}\u001b[m\n",
            "\u001b[31m-    Age = 42    # @param {type: \"integer\"}\u001b[m\n",
            "\u001b[31m-    return locals()\u001b[m\n",
            "\u001b[32m+\u001b[m\u001b[32m  # @title Test Form\u001b[m\n",
            "\u001b[32m+\u001b[m\u001b[32m  Name = 'John Doe'    # @param {type: \"string\"}\u001b[m\n",
            "\u001b[32m+\u001b[m\u001b[32m  Age = 42    # @param {type: \"integer\"}\u001b[m\n",
            "\u001b[32m+\u001b[m\u001b[32m  return locals()\u001b[m\n",
            " \u001b[m\n",
            " print(config_dict())\u001b[m\n",
            "\u001b[m\n",
            "\n",
            "\u001b[0m\u001b[34m## modified /cells/7/source:\u001b[0m\n",
            "\u001b[36m@@ -1,3 +1,3 @@\u001b[m\n",
            "\u001b[31m-# it works!\u001b[m\n",
            "\u001b[31m-from epc import encode\u001b[m\n",
            "\u001b[31m-encode({'the':'cat','in':'hat'})\u001b[m\n",
            "\u001b[m\n",
            "\u001b[32m+\u001b[m\u001b[32m# it works! It also overwrites c['epc']\u001b[m\n",
            "\u001b[32m+\u001b[m\u001b[32m# from epc import encode\u001b[m\n",
            "\u001b[32m+\u001b[m\u001b[32m# epc.encode({'the':'cat','in':'hat'})\u001b[m\n",
            "\u001b[m\n",
            "\n",
            "\u001b[0m\u001b[34m## modified /cells/9/metadata/id:\u001b[0m\n",
            "\u001b[31m-  GvSznl-9nLYJ\n",
            "\u001b[32m+  d_fJEcJWzB9Y\n",
            "\n",
            "\u001b[0m\u001b[34m## inserted before /cells/10:\u001b[0m\n",
            "\u001b[32m+  code cell:\n",
            "\u001b[32m+    metadata (unknown keys):\n",
            "\u001b[32m+      id: MOwr_7TOyr7M\n",
            "\u001b[32m+    source:\n",
            "\u001b[32m+      if c['running_nb'] == c['nb_name']: run_nb('git_for_colab')\n",
            "\n",
            "\u001b[0m\u001b[34m## modified /cells/10/metadata/id:\u001b[0m\n",
            "\u001b[31m-  r2mlfl-lNwoU\n",
            "\u001b[32m+  WR6rqKiBy9gR\n",
            "\n",
            "\u001b[0m\u001b[34m## modified /cells/10/source:\u001b[0m\n",
            "\u001b[36m@@ -1,4 +1,4 @@\u001b[m\n",
            "\u001b[31m-#@title Commit Message { run: \"auto\", vertical-output: true }\u001b[m\n",
            "\u001b[32m+\u001b[m\u001b[32m#@title Git Commit Message { run: \"auto\", vertical-output: true }\u001b[m\n",
            " commit_message = \"\" #@param {type:\"string\"}\u001b[m\n",
            " commit_message = c.get('commit_message','colab')+commit_message\u001b[m\n",
            " print(commit_message)\u001b[m\n",
            "\u001b[m\n",
            "\n",
            "\u001b[0m\u001b[34m## modified /cells/11/source:\u001b[0m\n",
            "\u001b[36m@@ -1,8 +1,8 @@\u001b[m\n",
            " %%from_template git\u001b[m\n",
            " #@title Git Actions { run: \"auto\", vertical-output: true }\u001b[m\n",
            "\u001b[31m-if c['run_nb'] == c['nb_name']:\u001b[m\n",
            "\u001b[32m+\u001b[m\u001b[32mif c['running_nb'] == c['nb_name']:\u001b[m\n",
            "   github_index = 0 #@param [\"0\", \"1\", \"2\"] {type:\"raw\"}\u001b[m\n",
            "\u001b[31m-  git_action = \"ppush*\" #@param [\"\",\"nb2repo*\",\"pull\",\"diff\",\"diff origin --minimal\",\"git_nbastatus*\",\"commit -m {message}\",\"push\",\"ppush*\",\"status\",\"fetch\",\"merge\",\"push origin dev\",\"diff main dev\",\"merge main\",\"merge dev\",\"checkout main\",\"checkout dev\",\"diff --staged\",\"restore\",\"add .\",\"branch -a\",\"log -15 --graph --oneline --decorate\",\"reset --hard HEAD\",\"reset --hard HEAD~1\",\"commit --amend -m {messaage}\"]\u001b[m\n",
            "\u001b[32m+\u001b[m\u001b[32m  git_action = \"pull\" #@param [\"\",\"nb2repo*\",\"pull\",\"diff\",\"diff origin --minimal\",\"git_nbastatus*\",\"commit -m {message}\",\"push\",\"ppush*\",\"status\",\"fetch\",\"merge\",\"push origin dev\",\"diff main dev\",\"merge main\",\"merge dev\",\"checkout main\",\"checkout dev\",\"diff --staged\",\"restore\",\"add .\",\"branch -a\",\"log -15 --graph --oneline --decorate\",\"reset --hard HEAD\",\"reset --hard HEAD~1\",\"commit --amend -m {messaage}\"]\u001b[m\n",
            " \u001b[m\n",
            "   print('repo indices: '+str(dict(zip(range(len(c['github'])),c['github']))))\u001b[m\n",
            "   if github_index > len(c['github'])-1:\u001b[m\n",
            "\n",
            "\u001b[0m\u001b[34m## modified /cells/12/source:\u001b[0m\n",
            "\u001b[36m@@ -1,2 +1 @@\u001b[m\n",
            "\u001b[31m-# if c['nb_run_by'] == c['nb_name']:\u001b[m\n",
            "\u001b[31m-#   git_ppush('colab')\u001b[m\n",
            "\u001b[m\n",
            "\u001b[32m+\u001b[m\u001b[32m# if c['run_nb'] == c['nb_name']: git_ppush('colab')\u001b[m\n",
            "\u001b[m\n",
            "\n",
            "\u001b[0m\u001b[34m## inserted before /cells/13:\u001b[0m\n",
            "\u001b[32m+  code cell:\n",
            "\u001b[32m+    metadata (unknown keys):\n",
            "\u001b[32m+      id: 9Ro27GgBF8LZ\n",
            "\n",
            "\u001b[0m\u001b[34m## deleted /cells/13:\u001b[0m\n",
            "\u001b[31m-  code cell:\n",
            "\u001b[31m-    metadata (unknown keys):\n",
            "\u001b[31m-      executionInfo:\n",
            "\u001b[31m-        elapsed: 188\n",
            "\u001b[31m-        status: aborted\n",
            "\u001b[31m-        timestamp: 1673691888964\n",
            "\u001b[31m-        user:\n",
            "\u001b[31m-          displayName: Jaci ss\n",
            "\u001b[31m-          userId: 10130648813270993501\n",
            "\u001b[31m-        user_tz: 540\n",
            "\u001b[31m-      id: 9Ro27GgBF8LZ\n",
            "\u001b[31m-    source:\n",
            "\u001b[31m-      # c['nb_name'] = c['nb_run_by'] # give nb_name back to any calling notebooks\n",
            "\n",
            "\u001b[0m\u001b[34m## added /metadata/colab/toc_visible:\u001b[0m\n",
            "\u001b[32m+  True\n",
            "\n",
            "\u001b[0mAlready up to date.\n",
            "On branch main\n",
            "Your branch is up to date with 'origin/main'.\n",
            "\n",
            "Changes to be committed:\n",
            "  (use \"git reset HEAD <file>...\" to unstage)\n",
            "\n",
            "\t\u001b[32mmodified:   notebooks/demo_notebook.ipynb\u001b[m\n",
            "\n",
            "message:  |colab\n",
            "Do you want to commit now? y/n: y\n",
            "[main 6841e6b]  |colab\n",
            " 1 file changed, 57 insertions(+), 224 deletions(-)\n",
            "Counting objects: 4, done.\n",
            "Delta compression using up to 2 threads.\n",
            "Compressing objects: 100% (4/4), done.\n",
            "Writing objects: 100% (4/4), 838 bytes | 838.00 KiB/s, done.\n",
            "Total 4 (delta 3), reused 0 (delta 0)\n",
            "remote: Resolving deltas: 100% (3/3), completed with 3 local objects.\u001b[K\n",
            "To https://github.com/Jaciss/jai.git\n",
            "   770a089..6841e6b  main -> main\n",
            "Already up to date.\n"
          ]
        }
      ],
      "source": [
        "# %%from_template first_cell\n",
        "try:\n",
        "  c\n",
        "except:\n",
        "  c = {'github':['jai'],'use_google_drive':False}\n",
        "  !wget -qO epc.py https://maya.software/epc.txt\n",
        "  import epc\n",
        "  c = epc.load_requests(c)\n",
        "  %run {c.get('nb_dir')}setup_project.ipynb\n",
        "\n",
        "if epc.os.path.isdir(c['projects_dir']+c['active_project']+'/.git'):\n",
        "  !cd {c['projects_dir']}{c['active_project']} && git pull"
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "c"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "RlMn08iUwYSa",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1673711917684,
          "user_tz": 540,
          "elapsed": 110,
          "user": {
            "displayName": "Jaci ss",
            "userId": "10130648813270993501"
          }
        },
        "outputId": "8a4b42f9-6ced-4223-f855-fad1f18a5d4c"
      },
      "execution_count": 2,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "{'log_level': 10,\n",
              " 'timezone': 'America/Anchorage',\n",
              " 'use_google_drive': False,\n",
              " 'epc': 'U2FsdGVkX1+ShJhgVb/247GaHNsoV03UAGyM7NJpwUmuF9odJf1idbEivOH2WWeqLvMfx0XyiqpVD3DfC30Ke/ko2WGeDOV8+EOcVQUUGmJf6C6QLHai8ZQAOykiGfPdeTnbIPMYXrmRA3u0TwTnYxwn0jyh33Tr4vfPm9NEi6TGQ4C2FZ6IJgmLaCJRXmd/qIlA/RkNAxPNtkVIWoPEHnuEn/hov0C4DX0olEk8Uiv8q1w/bXuFDKiH/8GgiZ55X+w2zi3SVciA7bIKxbT+0icwjXah0P5E0EJhAd5Csmgi+M+D3FVUpaU3t9Z/dgGGvcGZs43oYlpBN08YNetneJr+pzsbg1BeDtySZu1f+9xLKvynC6ISPiQCLK1xp8KjV1veklEFH77RUzieB0CfiySvRIAl0V7+onwGKCNG3FYWVRsciwezB1KIp0OiSSxktFWxTUylF3rSAD3vw7Xgh5g6QJ/v8FI5Fd2HDixiV66Gx2DBIJdprJ68rwEK+8czk6U9nKEnnv08dp559Oex7PuM0IObz0zWcR1uS1oELvZsTVAnlM+uTjF2zMVm4pdae+JkgIRFMm8Lwunjbx/rfXKSv4tSd0ZvPDlwHOwBsI68UT5NHajMrO1GwWh9p57vPwlFO2k+/CpmUqJ7eYSL8g==',\n",
              " 'github': ['jai'],\n",
              " 'projects_dir': '/content/',\n",
              " 'active_project': 'jai',\n",
              " 'nb_dir': '/content/jai/notebooks/',\n",
              " 'nb_ip': '172.28.0.2',\n",
              " 'nb_name': 'demo_notebook',\n",
              " 'running_nb': 'demo_notebook',\n",
              " 'nb_path': '16lStkEHaw79nR9XAY7Hurqoif0HPScys'}"
            ]
          },
          "metadata": {},
          "execution_count": 2
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "# epc.decode(c['epc']).keys()"
      ],
      "metadata": {
        "id": "kpcWWNgTQhqk",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1673711917694,
          "user_tz": 540,
          "elapsed": 83,
          "user": {
            "displayName": "Jaci ss",
            "userId": "10130648813270993501"
          }
        }
      },
      "execution_count": 3,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "# %macro\n",
        "# %hist"
      ],
      "metadata": {
        "id": "9c8oQ29nrWEQ",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1673711917696,
          "user_tz": 540,
          "elapsed": 83,
          "user": {
            "displayName": "Jaci ss",
            "userId": "10130648813270993501"
          }
        }
      },
      "execution_count": 4,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "# epc.__e\n",
        "# dir(epc)\n",
        "# [item for item in dir(epc) if not item.startswith(\"__\")]\n",
        "# epc.__e = {}"
      ],
      "metadata": {
        "id": "wA9HxrSZ2T1x",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1673711917698,
          "user_tz": 540,
          "elapsed": 84,
          "user": {
            "displayName": "Jaci ss",
            "userId": "10130648813270993501"
          }
        }
      },
      "execution_count": 5,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "def config_dict():\n",
        "  # @title Test Form\n",
        "  Name = 'John Doe'    # @param {type: \"string\"}\n",
        "  Age = 42    # @param {type: \"integer\"}\n",
        "  return locals()\n",
        "\n",
        "print(config_dict())"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "YUt-vBTp2dV5",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1673711917700,
          "user_tz": 540,
          "elapsed": 84,
          "user": {
            "displayName": "Jaci ss",
            "userId": "10130648813270993501"
          }
        },
        "outputId": "8f497fe1-8b97-4361-d99d-cfa8449f2a39"
      },
      "execution_count": 6,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "{'Name': 'John Doe', 'Age': 42}\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "# it works! It also overwrites c['epc']\n",
        "# from epc import encode\n",
        "# epc.encode({'the':'cat','in':'hat'})"
      ],
      "metadata": {
        "id": "4Lor3iba7sT4",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1673711917701,
          "user_tz": 540,
          "elapsed": 73,
          "user": {
            "displayName": "Jaci ss",
            "userId": "10130648813270993501"
          }
        }
      },
      "execution_count": 7,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "# EOF"
      ],
      "metadata": {
        "id": "_SEVQ_2j5vwI"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "## Git"
      ],
      "metadata": {
        "id": "d_fJEcJWzB9Y"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "if c['running_nb'] == c['nb_name']: run_nb('git_for_colab')"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "MOwr_7TOyr7M",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1673711918848,
          "user_tz": 540,
          "elapsed": 1218,
          "user": {
            "displayName": "Jaci ss",
            "userId": "10130648813270993501"
          }
        },
        "outputId": "4cf17983-924a-4cf3-ec51-ad0710a6ae7b"
      },
      "execution_count": 8,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "2023-01-14 06:58:37 INFO     /content/jai/notebooks/demo_notebook --> /content/jai/notebooks/git_for_colab\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "run_nb( git_for_colab ) nb_name: demo_notebook current running_nb set to: demo_notebook\n",
            "running: git_for_colab\n",
            "Overwriting /root/.jupyter/nbdime_config.json\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "#@title Git Commit Message { run: \"auto\", vertical-output: true }\n",
        "commit_message = \"\" #@param {type:\"string\"}\n",
        "commit_message = c.get('commit_message','colab')+commit_message\n",
        "print(commit_message)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "WR6rqKiBy9gR",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1673711918855,
          "user_tz": 540,
          "elapsed": 150,
          "user": {
            "displayName": "Jaci ss",
            "userId": "10130648813270993501"
          }
        },
        "outputId": "87bff3b0-47e2-48ee-a9cc-4e5af4335c4f"
      },
      "execution_count": 9,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "colab\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "%%from_template git\n",
        "#@title Git Actions { run: \"auto\", vertical-output: true }\n",
        "if c['running_nb'] == c['nb_name']:\n",
        "  github_index = 0 #@param [\"0\", \"1\", \"2\"] {type:\"raw\"}\n",
        "  git_action = \"git_nbastatus*\" #@param [\"\",\"nb2repo*\",\"pull\",\"diff\",\"diff origin --minimal\",\"git_nbastatus*\",\"commit -m {message}\",\"push\",\"ppush*\",\"status\",\"fetch\",\"merge\",\"push origin dev\",\"diff main dev\",\"merge main\",\"merge dev\",\"checkout main\",\"checkout dev\",\"diff --staged\",\"restore\",\"add .\",\"branch -a\",\"log -15 --graph --oneline --decorate\",\"reset --hard HEAD\",\"reset --hard HEAD~1\",\"commit --amend -m {messaage}\"]\n",
        "\n",
        "  print('repo indices: '+str(dict(zip(range(len(c['github'])),c['github']))))\n",
        "  if github_index > len(c['github'])-1:\n",
        "    print('no repo at that index')\n",
        "  else:\n",
        "    print('repo:',c['github'][github_index])\n",
        "  if git_action!='':\n",
        "    if git_action=='nb2repo*': nb2repo()\n",
        "    elif git_action=='ppush*': git_ppush(commit_message)\n",
        "    elif git_action=='git_nbastatus*': git_nbastatus(github_index)\n",
        "    else:\n",
        "      if git_action==\"commit -m {message}\": git_action = f\"commit -m '{commit_message}'\"\n",
        "      if git_action==\"commit --amend -m {messaage}\": git_action = f\"commit --amend -m '{commit_message}'\"\n",
        "      !cd {c['github'][github_index]} && git {git_action}"
      ],
      "metadata": {
        "id": "lpGRGIU-Qqpx"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "# if c['run_nb'] == c['nb_name']: git_ppush('colab')"
      ],
      "metadata": {
        "id": "dUEyAbF4o5sk",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1673711918881,
          "user_tz": 540,
          "elapsed": 89,
          "user": {
            "displayName": "Jaci ss",
            "userId": "10130648813270993501"
          }
        }
      },
      "execution_count": 11,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [],
      "metadata": {
        "id": "9Ro27GgBF8LZ",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1673711918893,
          "user_tz": 540,
          "elapsed": 95,
          "user": {
            "displayName": "Jaci ss",
            "userId": "10130648813270993501"
          }
        }
      },
      "execution_count": 11,
      "outputs": []
    }
  ]
}