Skip to main content

Format xonsh history to post it to Github or another page.

Project description

Format xonsh history to post it to Github or another page.

The mission of xontrib-hist-format is to make commands repeatable, copy-pastable and save time to preparing.

If you like the idea click ⭐ on the repo and stay tuned.

Installation

xpip install xontrib-hist-format
# or: xpip install -U git+https://github.com/anki-code/xontrib-hist-format

Usage

xontrib load hist_format
hist-format --help         # Basic command
hist-md                    # Markdown format shortcut
hist-txt                   # Text format shortcut

Arguments:

usage: hist-format [-h] [-f FORMAT] [-c COMMANDS_COUNT] [-l] 
                   [-H [OUTPUT_HEAD_COUNT]] [-T [OUTPUT_TAIL_COUNT]]
                   [-m] [--lines]

Format xonsh history to post it to Github or another page.

optional arguments:
  -h, --help            show this help message and exit
  -f FORMAT, --format FORMAT
                        Format: md, txt.
  -c COMMANDS_COUNT, --commands-count COMMANDS_COUNT
                        Count of commands
  -l, --commands-list   Show commands in distinct section.
  -H [OUTPUT_HEAD_COUNT], --output-head-count [OUTPUT_HEAD_COUNT]
                        Count of lines from output head to show.
  -T [OUTPUT_TAIL_COUNT], --output-tail-count [OUTPUT_TAIL_COUNT]
                        Count of lines from output tail to show.
  -m, --min             Make block minimized i.e. by adding <details> tag in Markdown.
  --lines               Add additional lines before and after.

Note! The clear command is used as marker of the beginning of commands list. If you run commands 1, 2, 3 then run clear, and run 4, 5, 6 and finally run hist-md it will show 4, 5, 6 commands. Feel free to open an issue with feedback on this approach.

Example

Run commands:

echo 123
ls / | head -n 3

Run hist-format:

hist-md -c 2 -l --lines    # latest 2 commands + commands list + header and footer as line

As result you will get the output that you can copy and paste to the Github comment or md-file:


Output:

echo 123
#123

ls / | head -n 3
#boot
#cdrom
#dev

# Prepared by xontrib-hist-format

Commands:

echo 123
ls / | head -n 3

# Prepared by xontrib-hist-format

Clipboard

You can redirect the output to clipboard. Example for xclip:

hist-md | xclip

Known issues

Not every command has output in the __xonsh__.history.

Credits

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xontrib-hist-format-0.0.8.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

xontrib_hist_format-0.0.8-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file xontrib-hist-format-0.0.8.tar.gz.

File metadata

  • Download URL: xontrib-hist-format-0.0.8.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for xontrib-hist-format-0.0.8.tar.gz
Algorithm Hash digest
SHA256 36dd5c8c7105a5a4bb1b00218b01799f91256921a26bf79e0cd1e1f47d56eb68
MD5 3cf4e9538505c3c9d19f16983ba8d23c
BLAKE2b-256 2d129d97dabc1ce7b224b4ce348993592cd73c861bfa4a02308c6119182e2366

See more details on using hashes here.

File details

Details for the file xontrib_hist_format-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: xontrib_hist_format-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for xontrib_hist_format-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 94cebb3ed1819236c3f83a13539adc8ff9bfd247f5da61993a426aba327b18bb
MD5 506f13ba1ae85a4cce78b8573b3ddc70
BLAKE2b-256 cf01a7e6b239bde8d53acd0412ba64c1aa404be9836b163ec04ab69ec4e34d01

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page