Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ryan-williams/bash-helpers
https://github.com/ryan-williams/bash-helpers
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ryan-williams/bash-helpers
- Owner: ryan-williams
- Created: 2019-04-26T20:15:31.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-11-11T02:36:49.000Z (about 2 months ago)
- Last Synced: 2024-11-11T03:26:45.188Z (about 2 months ago)
- Language: Shell
- Homepage:
- Size: 41 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bash-helpers
Misc aliases and scripts related to Bash vars and built-ins; part of [runsascoded/.rc](https://github.com/runsascoded/.rc)## `bash-markdown-fence.py` (a.k.a. `bm`)
```bash
bash-markdown-fence.py
# Usage: bash-markdown-fence.py [OPTIONS] [COMMAND]...
#
# Format a command and its output to markdown, either in a `bash`-fence or
# block, and copy it to the clipboard:
#
# Options:
# -C, --no-copy Disable copying output to clipboard (normally uses first
# available executable from ['pbcopy', 'xclip', 'clip']
# -f, --fence Pass 0-3x to configure output style: 0x: print output lines,
# prepended by "# ", in a `bash`-fence block; 1x: print a
# "```bash" fence block including the and commented
# output lines; 2x: print a bash-fenced command followed by
# plain-fenced output lines; 3x: print a block, with
# command and collapsed output lines in a plain
# fence.
# --help Show this message and exit.
```Examples, using the command `seq 5`:
### `bm seq 5`
This prints the output from `seq 5`, prefixed with `# ` to simulate Bash comments (for inclusion in a `bash`-"fence" block):
```bash
# 1
# 2
# 3
# 4
# 5
```### `bmf seq 5`
Passing the `-f`/`--fence` flag once includes the command in the `bash`-fence:
```bash
seq 5
# 1
# 2
# 3
# 4
# 5
```### `bmff seq 5`
Passing `-f`/`--fence` twice separates the `bash` command and its output into a `bash`-fence followed by a plain fence:
```bash
seq 5
```
```
1
2
3
4
5
```### `bmfff seq 5`
Passing `-f`/`--fence` three times outputs a `` block:seq 5
```
1
2
3
4
5
```