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
- 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.10.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 005bbc43c44b29b5e3f61959a2e067f5baab0b1a282c32142c92899909839e66 |
|
MD5 | a3c809549e45689eb5cdaac15b4633a0 |
|
BLAKE2b-256 | 4ccf754f7a7ad87d3c6401a09652e84bb474725c8f76909efef84141918196b9 |
Hashes for xontrib_hist_format-0.0.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37a37c592b32b0da9b4296ffaa18f33255a066f8f29399407f9a4cb75ba66876 |
|
MD5 | b6be512548c9dd944d3a3a6405b74932 |
|
BLAKE2b-256 | 1081b73f0bb01f59f82f46919c245baacb5366c5905fb27e2eff443bc2ea24a6 |