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
20082026
-
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)
comment by sunaookami · 2026-08-11 · in Go is an ideal language for AI-assisted software engineering -
…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.
comment by hu3 · 2025-05-09 · in Rust’s dependencies are starting to worry me -
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…
comment by latchkey · 2025-03-23 · in argp: GNU-style command line argument parser for Go -
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 -
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 –? –? -
…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,…
comment by PeterWhittaker · 2021-02-26 · in Show HN: Unix tool that visualizes shell commands usage -
…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 -
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 -
…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 -…
comment by programd · 2017-09-07 · in Ask HN: What Go framework for web API are you using in production?