Skip to content

Commit

Permalink
doc: fixed markdown layout in docs
Browse files Browse the repository at this point in the history
Signed-off-by: Frédéric BIDON <[email protected]>
  • Loading branch information
fredbi committed Sep 29, 2023
1 parent cc0487d commit e2e4af5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ This way, we no longer have to register CLI flags using dozen of type-specific m
* `NewFlagSliceValue()`: for flags as lists
* `NewFlagMapValue()`: for flags as map (e.g. key=value pairs)

The flag building logic is consistent for single values, slices and maps of all types.
The flag building logic is **consistent** for single values, slices and maps of all types.
Differences in semantics are handled with a set of `Option`s.

* **All primitive types** (yes, complex too!) are supported.
* All common types handled by `pflag` (`time.Duration`, `net.IP`, etc..) are also supported.
Expand All @@ -90,7 +91,6 @@ The flag building logic is consistent for single values, slices and maps of all

Variations in the semantics for a flag with a given underlying type may be fine-tuned with options.


There is an `extensions` sub-package to contribute some custom extra flag types.
It is now populated with a `byte-size` flag. See [the example](extensions/example_test.go).

Expand Down
6 changes: 3 additions & 3 deletions docs/approaches.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
A search on [`pkg.go.dev`](https://pkg.go.dev/search?q=flag&m=) provides some insight about the many CLI flag parsing
packages out there.

| repository |:Imported by`*`:| Approach | Distinctive features | Last published |
-----------------------------------------------------------------------------------------------------------------------------------------------
| repository | Imported by`*` | Approach | Distinctive features | Last published |
-----------------------------------------|---------------:|--------------|---------------------------------------------------|----------------|
|`flag` (standard library) | 278,354 | programmatic | Dead simple. Supports '-flag' or '--flag' styles. | 2023/09/06 |
|`https://github.com/spf13/pflag` | 29,126 | programmatic | Replaces `flag`. Supports POSIX style, e.g. '-xvf --flag'. | 2019/09/18 |
| | | | Arrays, maps & extra types. Extensible. | |
Expand All @@ -31,7 +31,7 @@ packages out there.

> Comments by fredbi, as of 2023/09/26
If we exclude the `pflag` standard library, usage of which is boosted by the eco-system of standard libraries,
If we exclude the `flag` standard library, usage of which is boosted by the eco-system of standard libraries,
`spf13/pflag` seems the most popular package,
most likely due to the popularity of the companion packages `spf13/cobra` and `spf13/viper`.

Expand Down

0 comments on commit e2e4af5

Please sign in to comment.