{"id":13343236,"url":"https://github.com/anki-code/xontrib-hist-format","last_synced_at":"2025-10-28T03:31:55.367Z","repository":{"id":62590102,"uuid":"310053790","full_name":"anki-code/xontrib-hist-format","owner":"anki-code","description":"Format xonsh history to post it to Github or another page.","archived":false,"fork":false,"pushed_at":"2023-02-16T15:15:45.000Z","size":29,"stargazers_count":8,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T11:11:09.262Z","etag":null,"topics":["xonsh","xonsh-dev","xontrib"],"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/anki-code.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"custom":["https://github.com/anki-code","https://www.buymeacoffee.com/xxh","https://github.com/xonsh/xonsh#the-xonsh-shell-community"]}},"created_at":"2020-11-04T16:12:55.000Z","updated_at":"2024-07-30T18:43:10.000Z","dependencies_parsed_at":"2023-01-30T03:46:05.386Z","dependency_job_id":null,"html_url":"https://github.com/anki-code/xontrib-hist-format","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anki-code%2Fxontrib-hist-format","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anki-code%2Fxontrib-hist-format/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anki-code%2Fxontrib-hist-format/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anki-code%2Fxontrib-hist-format/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anki-code","download_url":"https://codeload.github.com/anki-code/xontrib-hist-format/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238590596,"owners_count":19497350,"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":["xonsh","xonsh-dev","xontrib"],"created_at":"2024-07-29T19:30:42.855Z","updated_at":"2025-10-28T03:31:54.965Z","avatar_url":"https://github.com/anki-code.png","language":"Python","funding_links":["https://github.com/anki-code","https://www.buymeacoffee.com/xxh","https://github.com/xonsh/xonsh#the-xonsh-shell-community"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\nFormat xonsh history to post it to Github or another page.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\nThe mission of xontrib-hist-format is to make commands repeatable, copy-pastable and save time to preparing.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\nIf you like the idea click ⭐ on the repo and stay tuned.\n\u003c/p\u003e\n\n\n## Installation\n\n```bash\nxpip install xontrib-hist-format\n# or: xpip install -U git+https://github.com/anki-code/xontrib-hist-format\n```\n\n## Usage\n\n```bash\nxontrib load hist_format\nhist-format --help         # Basic command\nhist-md                    # Markdown format shortcut\nhist-txt                   # Text format shortcut\n```\n\nArguments:\n```\nusage: hist-format [-h] [-f FORMAT] [-c COMMANDS_COUNT] [-l]\n                   [-H [OUTPUT_HEAD_COUNT]] [-T [OUTPUT_TAIL_COUNT]]\n                   [-m] [--lines]\n\nFormat xonsh history to post it to Github or another page.\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -f FORMAT, --format FORMAT\n                        Format: md, txt.\n  -c COMMANDS_COUNT, --commands-count COMMANDS_COUNT\n                        Count of commands\n  -l, --commands-list   Show commands in distinct section.\n  -H [OUTPUT_HEAD_COUNT], --output-head-count [OUTPUT_HEAD_COUNT]\n                        Count of lines from output head to show.\n  -T [OUTPUT_TAIL_COUNT], --output-tail-count [OUTPUT_TAIL_COUNT]\n                        Count of lines from output tail to show.\n  -m, --min             Make block minimized i.e. by adding \u003cdetails\u003e tag in Markdown.\n  --lines               Add additional lines before and after.\n\n```\n\nNote! The `clear` command is used as marker of the beginning of commands list. If you run commands 1, 2, 3\nthen run `clear`, and run 4, 5, 6 and finally run `hist-md` it will show 4, 5, 6 commands.\nFeel free to open an issue with feedback on this approach.\n\n## Example\nRun commands:\n```python\necho 123\nls / | head -n 3\n```\nRun hist-format:\n```python\nhist-md -c 2 -l --lines    # latest 2 commands + commands list + header and footer as line\n```\nAs result you will get the output that you can copy and paste to the Github comment or md-file:\n\n------------------------------------------------------------------------------------------------------------------\n\nOutput:\n\n```python\necho 123\n#123\n\nls / | head -n 3\n#boot\n#cdrom\n#dev\n\n# Prepared by xontrib-hist-format\n```\n\nCommands:\n\n```python\necho 123\nls / | head -n 3\n\n# Prepared by xontrib-hist-format\n```\n\nYou can disable the \"Prepared by\" message by setting `XONTRIB_HIST_FORMAT_FOOTER = ''` in your environment. If you like this xontrib, tell your friends!\n\n------------------------------------------------------------------------------------------------------------------\n\n## Clipboard\n\nYou can redirect the output to clipboard. Example for [xclip](https://github.com/astrand/xclip):\n```python\nhist-md | xclip\n```\n\n## Known issues\n\n#### Not every command has output in the `__xonsh__.history`.\n\nWorkaround in some cases is to use pipe into `head` i.e. `cat file | head`.\n\n#### Not working after [xonsh 0.10.0](https://github.com/xonsh/xonsh/releases/tag/0.10.0) ([4283](https://github.com/xonsh/xonsh/pull/4283))\n\nWorkaround: Check `XONSH_CAPTURE_ALWAYS` environment variable to bring the capturing of the output back.\n\n## Credits\n\n* This package is the part of [ergopack](https://github.com/anki-code/xontrib-ergopack) - the pack of ergonomic xontribs.\n* This package was created with [xontrib cookiecutter template](https://github.com/xonsh/xontrib-cookiecutter).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanki-code%2Fxontrib-hist-format","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanki-code%2Fxontrib-hist-format","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanki-code%2Fxontrib-hist-format/lists"}