Skip to content

Commit

Permalink
Make my help look like TROFF manpage format.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisguest75 committed Oct 25, 2023
1 parent d9bbb5c commit c83a403
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 19 deletions.
10 changes: 7 additions & 3 deletions 01_argument_parsing/example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,18 @@ function help() {
local EXITCODE=0

cat <<- EOF
usage: $SCRIPT_NAME options
NAME
$SCRIPT_NAME - Example of argument parsing
OPTIONS:
SYNOPSIS
$SCRIPT_NAME [options]
OPTIONS
-a --action [ps|jobs|ls]
--debug
-h --help show this help
Examples:
EXAMPLES
$SCRIPT_NAME --action=ps
EOF
Expand Down
14 changes: 9 additions & 5 deletions 01_argument_parsing/simple_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ readonly SCRIPT_DIR=$(dirname "$SCRIPT_PATH")

function help() {
cat <<- EOF
usage: $SCRIPT_NAME options
NAME
$SCRIPT_NAME - Example of argument parsing
OPTIONS:
-h --help -? show this help
SYNOPSIS
$SCRIPT_NAME [options]
Examples:
$SCRIPT_NAME --help
OPTIONS
-h --help show this help
EXAMPLES
$SCRIPT_NAME --action=ps
EOF
}
Expand Down
5 changes: 4 additions & 1 deletion 06_restricted_bash/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# README

Demonstrate a restricted bash shell

## Examples

```sh
# open a restricted bash shell
bash -r
```

## Restricted

```sh
# can't do this
cd ..
Expand All @@ -17,4 +20,4 @@ cd ..
# can't do this either
TEMPFILE=$(mktemp)
echo "HELLO" > $TEMPFILE
```
```
4 changes: 4 additions & 0 deletions 09_deb_pkg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Demonstrates building a .deb packages repository

For help with installing Debian packages [README.md](../35_apt_and_dpkg/README.md)

TODO:

* Look at adequate - https://manpages.debian.org/testing/adequate/adequate.1.en.html

## Build .deb Examples

Build the image to build the packages and index
Expand Down
11 changes: 10 additions & 1 deletion 12_csv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

Demonstrate how to parse and work with CSV files

TODO: Fix the empty string handling
TODO:

* Fix the empty string handling
* Validate data being piped
* tidy viewer - https://github.com/alexhallam/tv

## Example

Expand Down Expand Up @@ -41,6 +45,11 @@ sqlite3 :memory: -cmd '.mode csv' -cmd '.import cpu.csv cpu' 'SELECT time, COUNT
https://til.simonwillison.net/sqlite/one-line-csv-operations


https://news.ycombinator.com/item?id=28670252
https://github.com/alexhallam/tv



iostat
vm_stat
ps wwaux | grep code
Expand Down
14 changes: 9 additions & 5 deletions 12_csv/csv2json.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ readonly SCRIPT_DIR=$(dirname "$SCRIPT_PATH")

function help() {
cat <<- EOF
usage: $SCRIPT_NAME options
NAME
$SCRIPT_NAME - Script reads a three column csv file and converts it to json
OPTIONS:
-h --help -? show this help
SYNOPSIS
$SCRIPT_NAME [options]
Examples:
$SCRIPT_NAME --help
OPTIONS
-h --help show this help
EXAMPLES
cat file.csv | $SCRIPT_NAME
EOF
}
Expand Down
11 changes: 7 additions & 4 deletions 49_brew/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,22 @@ Questions:

```sh
# installation directory
ls /usr/local/Homebrew
ls /usr/local/Homebrew

# list formulas installed
ls /usr/local/Cellar
ls /usr/local/Cellar

# casks are macnative apps
ls /usr/local/Caskroom

# view the download cache
ls -la $(brew --cache)
ls -la $(brew --cache)

# view softlinks to installed packages
ls -la /usr/local/bin
ls -la /usr/local/bin

# show the prefix
echo $(brew --prefix)
```

## Basic commands
Expand Down

0 comments on commit c83a403

Please sign in to comment.