octago / sflags Goto Github PK
View Code? Open in Web Editor NEWGenerate flags by parsing structures
License: BSD 3-Clause "New" or "Revised" License
Generate flags by parsing structures
License: BSD 3-Clause "New" or "Revised" License
I'm trying to build fdbe18c before starting to contribute, but:
make
fails$ make
Go generate
Formatting
Run vet
Run lint
Run metalinter
parser_test.go:28:3:warning: field name6 is unused (U1000) (megacheck)
make: *** [check] Error 1
I'm using the latest gometalinter
and I have ensured that the linters are up-to-date (gometalinter -i -u
)
go test
fails--- FAIL: TestValidator (0.00s)
Error Trace: parser_test.go:414
Error: Invalid operation: (sflags.ValidateFunc)(nil) == (sflags.ValidateFunc)(nil) (cannot take func type as argument)
Test: TestValidator
FAIL
exit status 1
FAIL github.com/octago/sflags 0.025s
I'm using the latest version of the assert
package: go get -u github.com/stretchr/testify/assert
It will be useful for gb users.
Neat lib ๐
Wondering if it would be possible to populate the help text of the cli opts based on the comment of the struct field ?
Cobra is already supported by pflags
, but some things, like environment variables, might be implemented only for cobra.
--when "tomorrow at 8 a.m"
Hi,
Hope you are all well !
I am using amalgomate, a go tool for combining multiple different main packages into a single program or library, and I would like to export flags from repacked packages and wrap them with your package, so I can get more details info while printing the help of the repacked package. (Feature actually missing in the current amalgomate version)
Is there a tool allowing to convert a flagset from a package by parsing the ast in order to insert a sflags structs and import your package ?
It could be done here:
https://github.com/palantir/amalgomate/blob/master/amalgomate/astfuncs.go#L121-L133
Thanks for any insights.
Cheers,
Rosco
Hello !
I'm posting a little message to "advertise" a project I've been working for a long time now, which is a merging of your own work and the concepts of https://github.com/jessevdk/go-flags, which brings a new array of possiblities and functionality to generated CLI tools.
Since your project was an immense help, because it helped me shifting my approach when working on go-flags, and that most of your code is still used in this new library, I wanted to make a heads-up here !
Link to the repo: https://github.com/reeflective/flags
Hope you will find it useful !
There have been a number of new features and bug fixes since the last tagged release, v0.2.0:
https://github.com/octago/sflags/compare/v0.2.0..master
Can we tag a new release to simply updates for projects using go mod
?
module declares its path as: github.com/sflags
but was required as: github.com/octago/sflags
go mod tidy fails
Something similar to kingpin`s stringMap implementation https://github.com/alecthomas/kingpin/blob/bf17db2c43f59ff3d97a39d1feacef18d75eaf95/values.go#L135
--map=key1:val1 --map=key2:val2
For example
type Multi struct {
Word Word
}
type Word struct {
String string
}
type Config struct {
Multi *Multi
MultiWord *Word
}
This sort of config results in both of those options being turned into the flag multi-word-string
. This causes some issues when sflags is used in combination with config file parsing libraries because it's impossible to automatically determine if multi-word-string
is multi.word.string
or multi-word.string
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.