<commit_before># getopts.fish

> Parse CLI options in fish.

Getopts is a CLI options parser for <a href="https://fishshell.com" title="friendly interactive shell">fish</a> based on the [POSIX Utility Syntax Guidelines](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02). This is like [`argparse`](https://fishshell.com/docs/current/commands.html#argparse) without the domain specific language, implicit variables, complex option spec, or companion commands.

## Installation

Install with [Fisher](https://github.com/jorgebucaran/fisher) (recommended):

```console
fisher add jorgebucaran/getopts.fish
```

<details>
<summary>Not using a package manager?</summary>

###

Copy [`getopts.fish`](getopts.fish) to any directory on your function path.

```fish
curl https://git.io/getopts.fish --create-dirs -sLo ~/.config/fish/functions/getopts.fish
```

</details>

## Getting Started

The `getopts` command splits your arguments into key-value records that can be read into variables.

```fish
$ engage --quadrant=delta -w9 <coordinates.dat
```

```fish
function engage -d "activate the warp drive"
    set -l warp 1
    set -l quadrant alpha
    set -l coordinates

    getopts $argv | while read -l key value
        switch $key
            case _
                while read -l target
                    set coordinates $coordinates $target
                end < $value
            case q quadrant
                set quadrant $value
            case w warp
                set warp $value
            case h help
                _engage_help >&2
                return
            case v version
                _engage_version >&2
                return<commit_msg>Add Quickstart<commit_after># getopts.fish

> Parse CLI options in fish.

Getopts is a CLI options parser for <a href="https://fishshell.com" title="friendly interactive shell">fish</a> based on the [POSIX Utility Syntax Guidelines](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02). This is like [`argparse`](https://fishshell.com/docs/current/commands.html#argparse) without the domain specific language, implicit variables, complex option spec, or companion commands.

## Installation

Install with [Fisher](https://github.com/jorgebucaran/fisher) (recommended):

```console
fisher add jorgebucaran/getopts.fish
```

<details>
<summary>Not using a package manager?</summary>

###

Copy [`getopts.fish`](getopts.fish) to any directory on your function path.

```fish
curl https://git.io/getopts.fish --create-dirs -sLo ~/.config/fish/functions/getopts.fish
```

</details>

## Quickstart

The `getopts` command splits your arguments into key-value records that can be read into variables.

```fish
$ engage --quadrant=delta -w9 <coordinates.dat
```

```fish
function engage -d "activate the warp drive"
    set -l warp 1
    set -l quadrant alpha
    set -l coordinates

    getopts $argv | while read -l key value
        switch $key
            case _
                while read -l target
                    set coordinates $coordinates $target
                end < $value
            case q quadrant
                set quadrant $value
            case w warp
                set warp $value
            case h help
                _engage_help >&2
                return
            case v version
                _engage_version >&2
                return
{'fraction_non_alphanumeric': 0.09947027663331372, 'fraction_numerical': 0.012360211889346674, 'mean_word_length': 2.5443169968717414, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '155006', 'n_tokens_mistral': 1030, 'n_tokens_neox': 939, 'n_words': 317}