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
To install use pip:
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 COUNT] [-l] [-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 COUNT, --count COUNT
Count of commands
-l, --show-commands-list
Show commands in distinct section.
-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
- This package is the part of ergopack - the pack of ergonomic xontribs.
- This package was created with xontrib cookiecutter template.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for xontrib-hist-format-0.0.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2798244758690bf17f0fffac02d08a4dfda15b5ae390f014ec1789a2300720e4 |
|
MD5 | 62c587b9b1a835f26cf19a58be0b514d |
|
BLAKE2b-256 | 67c962e406c4ae0e9a74571e788df68d905a577ae3cb7f367bba9dbc1beafb86 |
Hashes for xontrib_hist_format-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d77e758fc76da4508b948cfccf7dfd2947d20f39be739675c217337da63d5cf |
|
MD5 | 0fe11fb55a497c7d6228779cad3e420e |
|
BLAKE2b-256 | fb8f6b1c7a9b455ebbadf07a627d91380e31db762378699b8b260507d43df65b |