Skip to content

Commit

Permalink
0.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
a committed Nov 5, 2020
1 parent b76cb9c commit fdcea8a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@ hist-md # Markdown format shortcut
hist-txt # Text format shortcut
```
```
usage: hist-format [-h] [-f FORMAT] [-c COUNT] [-l]
usage: hist-format [-h] [-f FORMAT] [-c COUNT] [-cmd] [-l]
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
-cmd, --show-commands
Show commands in distinct section.
-l, --lines Add additional lines before and after.
```

Expand Down
5 changes: 2 additions & 3 deletions xontrib/hist_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def _hist_format(args):
argp = argparse.ArgumentParser(prog='hist-format', description="Format xonsh history to post it to Github or another page.")
argp.add_argument('-f', '--format', default='md', help="Format: md, txt.")
argp.add_argument('-c', '--count', default=10, help="Count of commands")
argp.add_argument('-sc', '--show-commands', action='store_true', help="Show commands in distinct section")
argp.add_argument('-cmd', '--show-commands', action='store_true', help="Show commands in distinct section.")
argp.add_argument('-l', '--lines', action='store_true', help="Add additional lines before and after.")
opt = argp.parse_args(args)

Expand Down Expand Up @@ -49,10 +49,9 @@ def _hist_format(args):
if h.out:
print()
print('\n'.join([format['comment'] + l for l in str(h.out).rstrip().split('\n')]))
print()
print(format['comment'] + ' Prepared by xontrib-hist-format')
print()
cmds.append(h.cmd.rstrip())
print(format['comment'] + ' Prepared by xontrib-hist-format')
print(format['end'])

if opt.show_commands:
Expand Down

0 comments on commit fdcea8a

Please sign in to comment.