Hacker GitHub

← All repos

spf13/pflag

View on GitHub ↗ ★ 2,784 Go

Drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags.

9 mentions on Hacker News by 8 people: 0 stories, 9 comments · first 2017-09-07 · latest 2026-08-11

Mentions per year 9 mentions · busiest year 2022 (2)
20082026
  1. Yeah same but I always allow https://github.com/spf13/pflag because e.g. Claude really struggles with the default flag package (and it's shit in general)
  2. …https://github.com/julienschmidt/httprouter 16k stars - https://github.com/gorilla/mux 21k stars - https://github.com/spf13/pflag 2.6k stars - https://github.com/google/uuid 5.6k starts Many others have just a few dependencies.
  3. Cobra https://github.com/spf13/cobra uses https://github.com/spf13/pflag , which supports GNU style flags. Cobra has been developed for many years now and has a ton of additional features, like automatically generating the autocompletions…
  4. Try github.com/spf13/pflag, it handles double-dash arguments OK, and is drop-in.
    comment by euroderf · 2022-05-07 · in Unix command line conventions over time
  5. The first rule of writing Go CLI tools that don’t drive users insane is to use “github.com/spf13/pflag” instead of the “flag” standard library package. Rather annoyingly that is often the only third party dependency required…
    comment by jen20 · 2022-04-16 · in -h –Help -help Help –? –?
  6. …go: downloading github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 go: downloading github.com/spf13/pflag v1.0.5 ...a whole lot of usage information... ...but nothing useful (not a go person, so, YMMV).... Any ideas? FYI,…
  7. …handling. No point reinventing the wheel or trying to remember some weird non-standard quirks. [1] https://github.com/spf13/pflag [2] https://github.com/spf13/cobra [3] https://github.com/spf13/viper
    comment by programd · 2020-08-01 · in Conventions for Command Line Options
  8. For gnu style long options you want: https://github.com/spf13/pflag It is a drop in replacement for the built in flag library. I ususally start out with the built in flag library and migrate to pflag when things get a bit more complicated.
    comment by nickcw · 2019-11-16 · in The Value in Go’s Simplicity
  9. …Here's my standard Nulladmin.com stack: Routing - https://github.com/go-chi/chi Command flags - https://github.com/spf13/pflag Config - https://github.com/spf13/viper Logging - https://github.com/Sirupsen/logrus Metrics -…