gitbetter


Namegitbetter JSON
Version 3.5.0 PyPI version JSON
download
home_page
SummaryCustom git shell to type less and commit more.
upload_time2024-01-14 20:41:52
maintainer
docs_urlNone
author
requires_python>=3.10
license
keywords cli commit git shell terminal
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # gitbetter

Custom git shell. Type less, commit more.

## Installation

Install with:

<pre>
pip install gitbetter
</pre>

## Usage
Launch from a terminal by entering `gitbetter`.<br>
Type `help` or `?` for a list of commands.<br>
Type `help {command}` for detailed help with a specific command.<br>
By default, If you enter a command that isn't built into `gitbetter`, it will be executed directly with `os.system()`,
allowing you to perform any command not defined by `gitbetter` that your shell supports without having to exit.<br>
To toggle this behavior, run the `toggle_unrecognized_command_behavior` 
(`gitbetter` uses `tab` for autocomplete, so you can type `"tog"`+`tab` instead of typing out the whole command name).<br>
When toggled to off, an unrecognized syntax message will be printed if you type in a command `gitbetter` doesn't recognize.<br>
The current state of this setting is printed at the bottom when running the `help` command.<br>
You can still execute a command in the shell regardless of this setting with the `sys` command.
<pre>
C:\gitbetter>gitbetter
Starting gitbetter...
Enter 'help' or '?' for command help.
gitbetter::C:\gitbetter>help

Built in Git commands (type '{command} -h' or '{command} --help'):
==================================================================
add            filter_branch  rebase                                version
am             format_patch   reflog                                whatchanged
annotate       fsck           remote                                worktree
archive        gc             repack
bisect         git            replace
blame          gitk           request_pull
branch         gitweb         rerere
bugreport      grep           reset
bundle         gui            restore
cd             help           revert
checkout       init           rm
cherry_pick    instaweb       scalar
citool         log            shortlog
clean          maintenance    show
clone          merge          show_branch
commit         merge_tree     sparse_checkout
config         mergetool      stash
count_objects  mv             status
describe       notes          submodule
diagnose       pack_refs      switch
diff           prune          sys
difftool       pull           tag
fast_export    push           toggle_unrecognized_command_behavior
fast_import    quit           verify_commit
fetch          range_diff     verify_tag

Convenience commands (type 'help {command}'):
=============================================
add_url   commitall      delete_gh_repo  loggy         new_branch     push_new
amend     commitf        ignore          make_private  new_gh_remote  undo
branches  delete_branch  initcommit      make_public   new_repo

Unrecognized command behavior: Execute in shell with os.system()
^Essentially makes this shell function as a super-shell of whatever shell you launched gitbetter from.^

gitbetter::C:\gitbetter>help commitf
Stage and commit a list of files.
Parser help for commitf:
usage: gitbetter [-h] -m MESSAGE [files ...]

positional arguments:
  files                 List of files to stage and commit.

options:
  -h, --help            show this help message and exit
  -m MESSAGE, --message MESSAGE
                        The commit message to use.

gitbetter::C:\gitbetter>help loggy
>>> git --oneline --name-only --abbrev-commit --graph

gitbetter::C:\gitbetter>loggy
*   3e780ec (HEAD -> main, tag: v1.0.0) Merge branch 'my-feature'
|\
| * b4478a3 feat: new print statement
| | test.py
* | eb89c2e docs: update readme
|/
|   README.md
* fc6b7ac (origin/main) docs: update readme
| README.md
* 2a75c0c docs: added a comment
| test.py
* d22129a feat: new print statement
| gitbetter_test.py
* 1a002d7 chore: add items to ignore
| .gitignore
* 92cb7e7 Initial commit
  .gitignore
  LICENSE.txt
  README.md
  gitbetter_test.py
  test.py
  test.txt
</pre>

Bindings can be accessed programmatically through the `Git` class.<br>
<pre>
>>> from gitbetter import Git
>>> git = Git()
>>> git.loggy()
*   3e780ec (HEAD -> main, tag: v1.0.0) Merge branch 'my-feature'
|\
| * b4478a3 feat: new print statement
| | test.py
* | eb89c2e docs: update readme
|/
|   README.md
* fc6b7ac (origin/main) docs: update readme
| README.md
* 2a75c0c docs: added a comment
| test.py
* d22129a feat: new print statement
| gitbetter_test.py
* 1a002d7 chore: add items to ignore
| .gitignore
* 92cb7e7 Initial commit
  .gitignore
  LICENSE.txt
  README.md
  gitbetter_test.py
  test.py
  test.txt
>>> git.list_branches()
* main                3e780ec [origin/main: ahead 3] Merge branch 'my-feature'
  remotes/origin/main fc6b7ac docs: update readme
</pre>
The `stdout` of `Git` functions can be returned as a string rather than being printed to the terminal
by passing `True` to the `Git` constructor or setting the member variable `capture_stdout` to `True`.
<pre>
>>> from gitbetter import Git
>>> git = Git(True)
# or
>>> git.capture_stdout = True
>>> log = git.loggy()
>>> print(log)
*   3e780ec (HEAD -> main, tag: v1.0.0) Merge branch 'my-feature'
|\
| * b4478a3 feat: new print statement
| | test.py
* | eb89c2e docs: update readme
|/
|   README.md
* fc6b7ac (origin/main) docs: update readme
| README.md
* 2a75c0c docs: added a comment
| test.py
* d22129a feat: new print statement
| gitbetter_test.py
* 1a002d7 chore: add items to ignore
| .gitignore
* 92cb7e7 Initial commit
  .gitignore
  LICENSE.txt
  README.md
  gitbetter_test.py
  test.py
  test.txt
>>> git.list_branches()
* main                3e780ec [origin/main: ahead 3] Merge branch 'my-feature'
  remotes/origin/main fc6b7ac docs: update readme
</pre>

If capturing stdout is only desired for a set of functions, 
the `capture_output` function can be used as a context manager.
Upon entering the context, the `capture_stdout` property is set to `True`
and then set back to `False` upon exiting the context.
<pre>
>>> git = Git()
>>> with git.capture_output():
...  status = git.status()
...
>>> print(status)
On branch stdout-context-manager
Your branch is up to date with 'main'.

Changes not staged for commit:
  (use "git add <\file>..." to update what will be committed)
  (use "git restore <\file>..." to discard changes in working directory)
        modified:   src/gitbetter/git.py

no changes added to commit (use "git add" and/or "git commit -a")

</pre>

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "gitbetter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "cli,commit,git,shell,terminal",
    "author": "",
    "author_email": "Matt Manes <mattmanes@pm.me>",
    "download_url": "https://files.pythonhosted.org/packages/e8/09/634be3e4c65cbef6d018d98cb694eda150cfbf3235eb04f216ce675dbeb4/gitbetter-3.5.0.tar.gz",
    "platform": null,
    "description": "# gitbetter\n\nCustom git shell. Type less, commit more.\n\n## Installation\n\nInstall with:\n\n<pre>\npip install gitbetter\n</pre>\n\n## Usage\nLaunch from a terminal by entering `gitbetter`.<br>\nType `help` or `?` for a list of commands.<br>\nType `help {command}` for detailed help with a specific command.<br>\nBy default, If you enter a command that isn't built into `gitbetter`, it will be executed directly with `os.system()`,\nallowing you to perform any command not defined by `gitbetter` that your shell supports without having to exit.<br>\nTo toggle this behavior, run the `toggle_unrecognized_command_behavior` \n(`gitbetter` uses `tab` for autocomplete, so you can type `\"tog\"`+`tab` instead of typing out the whole command name).<br>\nWhen toggled to off, an unrecognized syntax message will be printed if you type in a command `gitbetter` doesn't recognize.<br>\nThe current state of this setting is printed at the bottom when running the `help` command.<br>\nYou can still execute a command in the shell regardless of this setting with the `sys` command.\n<pre>\nC:\\gitbetter>gitbetter\nStarting gitbetter...\nEnter 'help' or '?' for command help.\ngitbetter::C:\\gitbetter>help\n\nBuilt in Git commands (type '{command} -h' or '{command} --help'):\n==================================================================\nadd            filter_branch  rebase                                version\nam             format_patch   reflog                                whatchanged\nannotate       fsck           remote                                worktree\narchive        gc             repack\nbisect         git            replace\nblame          gitk           request_pull\nbranch         gitweb         rerere\nbugreport      grep           reset\nbundle         gui            restore\ncd             help           revert\ncheckout       init           rm\ncherry_pick    instaweb       scalar\ncitool         log            shortlog\nclean          maintenance    show\nclone          merge          show_branch\ncommit         merge_tree     sparse_checkout\nconfig         mergetool      stash\ncount_objects  mv             status\ndescribe       notes          submodule\ndiagnose       pack_refs      switch\ndiff           prune          sys\ndifftool       pull           tag\nfast_export    push           toggle_unrecognized_command_behavior\nfast_import    quit           verify_commit\nfetch          range_diff     verify_tag\n\nConvenience commands (type 'help {command}'):\n=============================================\nadd_url   commitall      delete_gh_repo  loggy         new_branch     push_new\namend     commitf        ignore          make_private  new_gh_remote  undo\nbranches  delete_branch  initcommit      make_public   new_repo\n\nUnrecognized command behavior: Execute in shell with os.system()\n^Essentially makes this shell function as a super-shell of whatever shell you launched gitbetter from.^\n\ngitbetter::C:\\gitbetter>help commitf\nStage and commit a list of files.\nParser help for commitf:\nusage: gitbetter [-h] -m MESSAGE [files ...]\n\npositional arguments:\n  files                 List of files to stage and commit.\n\noptions:\n  -h, --help            show this help message and exit\n  -m MESSAGE, --message MESSAGE\n                        The commit message to use.\n\ngitbetter::C:\\gitbetter>help loggy\n>>> git --oneline --name-only --abbrev-commit --graph\n\ngitbetter::C:\\gitbetter>loggy\n*   3e780ec (HEAD -> main, tag: v1.0.0) Merge branch 'my-feature'\n|\\\n| * b4478a3 feat: new print statement\n| | test.py\n* | eb89c2e docs: update readme\n|/\n|   README.md\n* fc6b7ac (origin/main) docs: update readme\n| README.md\n* 2a75c0c docs: added a comment\n| test.py\n* d22129a feat: new print statement\n| gitbetter_test.py\n* 1a002d7 chore: add items to ignore\n| .gitignore\n* 92cb7e7 Initial commit\n  .gitignore\n  LICENSE.txt\n  README.md\n  gitbetter_test.py\n  test.py\n  test.txt\n</pre>\n\nBindings can be accessed programmatically through the `Git` class.<br>\n<pre>\n>>> from gitbetter import Git\n>>> git = Git()\n>>> git.loggy()\n*   3e780ec (HEAD -> main, tag: v1.0.0) Merge branch 'my-feature'\n|\\\n| * b4478a3 feat: new print statement\n| | test.py\n* | eb89c2e docs: update readme\n|/\n|   README.md\n* fc6b7ac (origin/main) docs: update readme\n| README.md\n* 2a75c0c docs: added a comment\n| test.py\n* d22129a feat: new print statement\n| gitbetter_test.py\n* 1a002d7 chore: add items to ignore\n| .gitignore\n* 92cb7e7 Initial commit\n  .gitignore\n  LICENSE.txt\n  README.md\n  gitbetter_test.py\n  test.py\n  test.txt\n>>> git.list_branches()\n* main                3e780ec [origin/main: ahead 3] Merge branch 'my-feature'\n  remotes/origin/main fc6b7ac docs: update readme\n</pre>\nThe `stdout` of `Git` functions can be returned as a string rather than being printed to the terminal\nby passing `True` to the `Git` constructor or setting the member variable `capture_stdout` to `True`.\n<pre>\n>>> from gitbetter import Git\n>>> git = Git(True)\n# or\n>>> git.capture_stdout = True\n>>> log = git.loggy()\n>>> print(log)\n*   3e780ec (HEAD -> main, tag: v1.0.0) Merge branch 'my-feature'\n|\\\n| * b4478a3 feat: new print statement\n| | test.py\n* | eb89c2e docs: update readme\n|/\n|   README.md\n* fc6b7ac (origin/main) docs: update readme\n| README.md\n* 2a75c0c docs: added a comment\n| test.py\n* d22129a feat: new print statement\n| gitbetter_test.py\n* 1a002d7 chore: add items to ignore\n| .gitignore\n* 92cb7e7 Initial commit\n  .gitignore\n  LICENSE.txt\n  README.md\n  gitbetter_test.py\n  test.py\n  test.txt\n>>> git.list_branches()\n* main                3e780ec [origin/main: ahead 3] Merge branch 'my-feature'\n  remotes/origin/main fc6b7ac docs: update readme\n</pre>\n\nIf capturing stdout is only desired for a set of functions, \nthe `capture_output` function can be used as a context manager.\nUpon entering the context, the `capture_stdout` property is set to `True`\nand then set back to `False` upon exiting the context.\n<pre>\n>>> git = Git()\n>>> with git.capture_output():\n...  status = git.status()\n...\n>>> print(status)\nOn branch stdout-context-manager\nYour branch is up to date with 'main'.\n\nChanges not staged for commit:\n  (use \"git add <\\file>...\" to update what will be committed)\n  (use \"git restore <\\file>...\" to discard changes in working directory)\n        modified:   src/gitbetter/git.py\n\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\n</pre>\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Custom git shell to type less and commit more.",
    "version": "3.5.0",
    "project_urls": {
        "Documentation": "https://github.com/matt-manes/gitbetter/tree/main/docs",
        "Homepage": "https://github.com/matt-manes/gitbetter",
        "Source code": "https://github.com/matt-manes/gitbetter/tree/main/src/gitbetter"
    },
    "split_keywords": [
        "cli",
        "commit",
        "git",
        "shell",
        "terminal"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "21314805d320db366e1452ce6a98e1f284e770cb3dc8e7c4f0b6b1236cc903bd",
                "md5": "c9d3813b1abfcfdc017af318d6d4b441",
                "sha256": "38cbf25764485a9ba3b3fd984f4fa1d7e937e96e38531429d9a329612adf2483"
            },
            "downloads": -1,
            "filename": "gitbetter-3.5.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c9d3813b1abfcfdc017af318d6d4b441",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 12785,
            "upload_time": "2024-01-14T20:41:50",
            "upload_time_iso_8601": "2024-01-14T20:41:50.778264Z",
            "url": "https://files.pythonhosted.org/packages/21/31/4805d320db366e1452ce6a98e1f284e770cb3dc8e7c4f0b6b1236cc903bd/gitbetter-3.5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e809634be3e4c65cbef6d018d98cb694eda150cfbf3235eb04f216ce675dbeb4",
                "md5": "021d0c9448b00e368f3d8229d38cc986",
                "sha256": "a3640f07affa7da299b45b89d1c954592d21b7ae1d5b193723b104f9a7f8bab5"
            },
            "downloads": -1,
            "filename": "gitbetter-3.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "021d0c9448b00e368f3d8229d38cc986",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 144486,
            "upload_time": "2024-01-14T20:41:52",
            "upload_time_iso_8601": "2024-01-14T20:41:52.883772Z",
            "url": "https://files.pythonhosted.org/packages/e8/09/634be3e4c65cbef6d018d98cb694eda150cfbf3235eb04f216ce675dbeb4/gitbetter-3.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-14 20:41:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "matt-manes",
    "github_project": "gitbetter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "gitbetter"
}
        
Elapsed time: 0.18185s