diff --git a/README.md b/README.md index e961ab9..17cc1e9 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,21 @@ [![Codecov](https://img.shields.io/codecov/c/github/ko1nksm/getoptions?logo=codecov)](https://codecov.io/gh/ko1nksm/getoptions) [![kcov](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fko1nksm.github.io%2Fgetoptions%2Fcoverage.json&query=percent_covered&label=kcov&suffix=%25)](https://ko1nksm.github.io/getoptions/) [![GitHub top language](https://img.shields.io/github/languages/top/ko1nksm/getoptions.svg)](https://github.com/ko1nksm/getoptions/search?l=Shell) -[![License](https://img.shields.io/github/license/ko1nksm/getoptions.svg)](https://github.com/ko1nksm/getoptions/blob/master/LICENSE) +[![License](https://img.shields.io/github/license/ko1nksm/getoptions.svg)](https://github.com/ko1nksm/getoptions/blob/master/LICENSE)
+![Linux](https://img.shields.io/badge/Linux-ecd53f?style=flat) +![macOS](https://img.shields.io/badge/macOS-ecd53f?style=flat) +![BSD](https://img.shields.io/badge/BSD-ecd53f?style=flat) +![Solaris](https://img.shields.io/badge/Solaris-ecd53f?style=flat) +![AIX](https://img.shields.io/badge/AIX-ecd53f?style=flat) +![BusyBox](https://img.shields.io/badge/BusyBox-ecd53f?style=flat) +![Windows](https://img.shields.io/badge/Windows-ecd53f?style=flat) +![sh](https://img.shields.io/badge/sh-cec7d1.svg?style=flat) +![bash](https://img.shields.io/badge/bash-cec7d1.svg?style=flat) +![dash](https://img.shields.io/badge/dash-cec7d1.svg?style=flat) +![ksh](https://img.shields.io/badge/ksh-cec7d1.svg?style=flat) +![mksh](https://img.shields.io/badge/mksh-cec7d1.svg?style=flat) +![yash](https://img.shields.io/badge/yash-cec7d1.svg?style=flat) +![zsh](https://img.shields.io/badge/zsh-cec7d1.svg?style=flat) An elegant option parser for shell scripts (full support for all POSIX shells) @@ -26,7 +40,7 @@ parser_definition() { flag FLAG -f --flag -- "takes no arguments" param PARAM -p --param -- "takes one argument" option OPTION -o --option on:"default" -- "takes one optional argument" - disp :usage -h --help + disp :usage --help disp VERSION --version } @@ -38,10 +52,16 @@ printf '%s\n' "$@" # rest arguments It generates a simple [option parser code](#how-to-see-the-option-parser-code) internally and parses the following arguments. -```sh -example.sh -f --flag -p VALUE --param VALUE -o --option -oVALUE --option=VALUE 1 2 3 +```console +$ example.sh -f --flag -p value --param value -o --option -ovalue --option=value 1 2 3 +FLAG: 1, PARAM: value, OPTION: value +1 +2 +3 ``` +Automatic help generation is also provided. + ```console $ example.sh --help @@ -51,7 +71,7 @@ Options: -f, --flag takes no arguments -p, --param PARAM takes one argument -o, --option[=OPTION] takes one optional argument - -h, --help + --help --version ```