{"id":16216879,"url":"https://github.com/imomaliev/ptrepl","last_synced_at":"2025-07-16T01:13:42.246Z","repository":{"id":53477984,"uuid":"76529642","full_name":"imomaliev/ptrepl","owner":"imomaliev","description":"Run command as REPL with completion(based on prompt_toolkit)","archived":false,"fork":false,"pushed_at":"2023-07-20T13:12:35.000Z","size":141,"stargazers_count":41,"open_issues_count":9,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-09T12:46:12.334Z","etag":null,"topics":["bash","bash-completion","cli","python","repl"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imomaliev.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-15T06:14:57.000Z","updated_at":"2024-09-03T22:12:10.000Z","dependencies_parsed_at":"2022-08-18T01:06:17.390Z","dependency_job_id":null,"html_url":"https://github.com/imomaliev/ptrepl","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"purl":"pkg:github/imomaliev/ptrepl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imomaliev%2Fptrepl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imomaliev%2Fptrepl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imomaliev%2Fptrepl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imomaliev%2Fptrepl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imomaliev","download_url":"https://codeload.github.com/imomaliev/ptrepl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imomaliev%2Fptrepl/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265473026,"owners_count":23772028,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","bash-completion","cli","python","repl"],"created_at":"2024-10-10T11:23:14.653Z","updated_at":"2025-07-16T01:13:42.204Z","avatar_url":"https://github.com/imomaliev.png","language":"Python","readme":"======\nptrepl\n======\n\n.. image:: https://travis-ci.com/imomaliev/ptrepl.svg?branch=master\n    :target: https://travis-ci.com/imomaliev/ptrepl\n.. image:: https://badge.fury.io/py/ptrepl.svg\n    :target: https://badge.fury.io/py/ptrepl\n\nAbout\n-----\nMake REPL out of any bash command\n\n- has bash completion\n- has vi mode\n- has PS1 parsing(experimental)\n- stores history in ``$XDG_DATA_HOME/ptrepl/history``\n- bash like history expansion\n- list history\n- command mode\n- aliases\n\nInstallation\n------------\nRequires ``python\u003e=3.6``, ``prompt_toolkit\u003e=2.0.7,\u003c3.0.0``, ``pygments``\n\nRecommended way of installation is via ``pipx``\n\n.. code:: bash\n\n    pipx install ptrepl\n\n``ptrepl`` vendors https://github.com/xonsh/py-bash-completion\n\nUsage\n-----\nBasic Usage\n^^^^^^^^^^^\n.. code:: bash\n\n    $ ptrepl --help\n    Usage: ptrepl [OPTIONS] COMMAND\n\n    Options:\n    --prompt TEXT  Override prompt\n    --help         Show this message and exit.\n    $ ptrepl git\n    $ git \u003e\n    # to call \"git status\"\n    $ git \u003e status\n    # if you need execute some other bash command see system mode below\n\nCustom prompt command\n^^^^^^^^^^^^^^^^^^^^^\n.. code:: bash\n\n    $ ptrepl git --prompt g\n    $ g \u003e\n\nMultiword command\n^^^^^^^^^^^^^^^^^\n.. code:: bash\n\n    $ ptrepl \"echo prefix\"\n    $ echo prefix \u003e 1\n    echo prefix 1\n\nConfig\n------\nPlace settings file in :bash:``$XDG_CONFIG_HOME/ptrepl/config.json``\n\nHere is example of config with enabled vi mode and git alias\n\n.. code:: json\n\n    {\n        \"settings\": {\n            \"EXIT_COMMAND\": \"exit\",\n            \"EDITING_MODE\": \"vi\",\n            \"SHOW_MODE_IN_PROMPT\": true,\n            \"EMACS_MODE_STRING\": \"@\",\n            \"VI_INS_MODE_STRING\": \"+\",\n            \"VI_CMD_MODE_STRING\": \":\",\n            \"READLINE_COMPLETION\": false,\n            \"PARSE_PS1\": false,\n            \"LOCAL_SHADA\": false,\n            \"LOCAL_SHADA_PATH\": \"$PWD/.ptrepl/\",\n        },\n        \"alias\": {\n            \"git st\": \"git status\"\n        }\n    }\n\nAvailable settings\n^^^^^^^^^^^^^^^^^^\n- EXIT_COMMAND - change exit command\n- EDITING_MODE - choose mode vi/emacs\n- SHOW_MODE_IN_PROMPT - show editing mode string in prompt\n- EMACS_MODE_STRING - set emacs mode prompt string\n- VI_INS_MODE_STRING - set vi insert mode prompt string\n- VI_CMD_MODE_STRING - set vi command mode prompt string\n- READLINE_COMPLETION: use readline like completion instead of dropdown one\n- PARSE_PS1 {experimental} - will try to adgust ptrepl's prompt according to your PS1 setting\n- LOCAL_SHADA - store shada(history) in LOCAL_SHADA_PATH\n- LOCAL_SHADA_PATH - path to local shada\n\nDefault settings\n^^^^^^^^^^^^^^^^\n.. code:: json\n\n    {\n        \"EXIT_COMMAND\": \"exit\",\n        \"EDITING_MODE\": \"emacs\",\n        \"SHOW_MODE_IN_PROMPT\": false,\n        \"EMACS_MODE_STRING\": \"@\",\n        \"VI_INS_MODE_STRING\": \"(ins)\",\n        \"VI_CMD_MODE_STRING\": \"(cmd)\",\n        \"READLINE_COMPLETION\": false,\n        \"PARSE_PS1\": false,\n        \"LOCAL_SHADA\": false,\n        \"LOCAL_SHADA_PATH\": \"$DIRENV_DIR/.direnv/ptrepl/\",\n    }\n\nFeatures\n--------\n\nParsing PS1(requires PARSE_PS1 set to true)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nHere is how my bash prompt(PS1) looks like by default\n\n.. code:: bash\n\n    {ptrepl} ~/Development/Python/ptrepl [master] |19:18:36 07-Feb-18|\n    + ❯ ptrepl git\n    {ptrepl} ~/Development/Python/ptrepl [master] |19:20:15 07-Feb-18|\n    + git ❯\n\nCompletion\n^^^^^^^^^^\n.. code:: bash\n\n    $ ptrepl git\n    $ git \u003e sta (press TAB)\n    # result\n    $ git \u003e sta\n            status\n            stage\n            stash\n\nReadline like completion(requires READLINE_COMPLETION set to true)\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n.. code:: bash\n\n    $ ptrepl git\n    $ git \u003e sta (press TAB)\n    # result\n    $ git \u003e sta\n    stage  stash  status\n\n\nSystem mode\n^^^^^^^^^^^\n.. code:: bash\n\n    $ ptrepl git\n    $ git \u003e (press Escape + !)\n    # result\n    # you could enter your shell commands here\n    Shell command: ls\n\nCommand mode\n^^^^^^^^^^^^\n.. code:: bash\n\n    $ ptrepl git\n    $ git \u003e (press Escape + :)\n    # result\n    # you could enter your command mode commands here\n    # to list history\n    Command mode: history\n\nBash like history expansion\n^^^^^^^^^^^^^^^^^^^^^^^^^^^\n.. code:: bash\n\n    $ ptrepl git\n    $ git \u003e status\n    # repeat last command\n    $ git \u003e !!\n    # repeat 10th command\n    $ git \u003e !10\n    # repeat 10th command from bottom of history stack\n    $ git \u003e !-10\n\nBash like aliases\n^^^^^^^^^^^^^^^^^\n.. code:: bash\n\n    $ ptrepl git\n    $ git \u003e (press Escape + :)\n    # you could enter your command mode commands here\n    # to list alias\n    Command mode: alias\n    alias \"git st\"=\"git status\"\n    $ git \u003e st\n\nSimilar projects\n-------------------\nWritten in Ruby\n^^^^^^^^^^^^^^^\nhttps://github.com/defunkt/repl\n\nWritten in Bash\n^^^^^^^^^^^^^^^\nhttps://github.com/joh6nn/shrepl\n\nhttps://github.com/mchav/with\n\nWritten in Python\n^^^^^^^^^^^^^^^^^\nhttps://github.com/mbr/repl\n\nhttps://github.com/renanivo/with\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimomaliev%2Fptrepl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimomaliev%2Fptrepl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimomaliev%2Fptrepl/lists"}