From 1da4f410ed751d08944d4d9611dcd927e02f4966 Mon Sep 17 00:00:00 2001 From: Nathan Cooper Date: Tue, 24 Feb 2026 12:14:03 -0500 Subject: [PATCH] update -- docs --- README.md | 24 +++++++++++++++++------ nbs/index.ipynb | 51 +++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 63 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 66fe47f..b9c286d 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ In this example we run `git init` on a directory, add a *.gitignore*, and commit it. ``` python -import tempfile +import shutil, tempfile ``` ``` python @@ -34,11 +34,23 @@ def _git_init(g): ``` ``` python -with tempfile.TemporaryDirectory() as td: - g = Git(td) - _git_init(g) - assert 'add .gitignore' in g.last_commit - print(g.branch('--show-current')) +td = tempfile.mkdtemp() +g = Git(td) +_git_init(g) +assert 'add .gitignore' in g.last_commit +print(g.branch('--show-current')) ``` main + +You can also pass path arguments after `--` using the `__` parameter: + +``` python +g.log('--oneline', __=['.gitignore']) +``` + + '22a9a5d add .gitignore' + +``` python +shutil.rmtree(td) +``` diff --git a/nbs/index.ipynb b/nbs/index.ipynb index 320671c..b90a7ca 100644 --- a/nbs/index.ipynb +++ b/nbs/index.ipynb @@ -74,7 +74,7 @@ "metadata": {}, "outputs": [], "source": [ - "import tempfile" + "import shutil, tempfile" ] }, { @@ -109,11 +109,50 @@ } ], "source": [ - "with tempfile.TemporaryDirectory() as td:\n", - " g = Git(td)\n", - " _git_init(g)\n", - " assert 'add .gitignore' in g.last_commit\n", - " print(g.branch('--show-current'))" + "td = tempfile.mkdtemp()\n", + "g = Git(td)\n", + "_git_init(g)\n", + "assert 'add .gitignore' in g.last_commit\n", + "print(g.branch('--show-current'))" + ] + }, + { + "cell_type": "markdown", + "id": "306619e8", + "metadata": {}, + "source": [ + "You can also pass path arguments after `--` using the `__` parameter:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "32a5a2af", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'22a9a5d add .gitignore'" + ] + }, + "execution_count": null, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "g.log('--oneline', __=['.gitignore'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "aff78522", + "metadata": {}, + "outputs": [], + "source": [ + "shutil.rmtree(td)" ] } ],