A library to parse command line arguments for Golang application.
This library provides the following functionalities:
- Supports POSIX & GNU like short and long options.
- This library supports
--option. - This library doesn't support numeric short option.
- This library supports not
-ofoobut-o=fooas an alternative to-o foofor short option.
- This library supports
- Supports parsing with option configurations.
- Supports parsing with a struct which stores option values and has struct tags of fields.
- Is able to parse command line arguments including sub commands.
- Generates help text from option configurations.
import "github.com/sttk/cliargs"
The usage of this library is described on the overview in the go package document.
See https://pkg.go.dev/github.com/sttk/cliargs#pkg-overview
This library supports Go 1.18 or later.
% gvm-fav
Now using version go1.18.10
go version go1.18.10 darwin/amd64
ok github.com/sttk/cliargs 0.425s coverage: 97.6% of statements
ok github.com/sttk/cliargs/errors 0.632s coverage: 100.0% of statements
ok github.com/sttk/cliargs/validators 0.327s coverage: 100.0% of statements
Now using version go1.19.13
go version go1.19.13 darwin/amd64
ok github.com/sttk/cliargs 0.416s coverage: 97.6% of statements
ok github.com/sttk/cliargs/errors 0.659s coverage: 100.0% of statements
ok github.com/sttk/cliargs/validators 0.331s coverage: 100.0% of statements
Now using version go1.20.14
go version go1.20.14 darwin/amd64
ok github.com/sttk/cliargs 0.614s coverage: 97.6% of statements
ok github.com/sttk/cliargs/errors 0.309s coverage: 100.0% of statements
ok github.com/sttk/cliargs/validators 0.895s coverage: 100.0% of statements
Now using version go1.21.13
go version go1.21.13 darwin/amd64
ok github.com/sttk/cliargs 0.315s coverage: 97.6% of statements
ok github.com/sttk/cliargs/errors 0.603s coverage: 100.0% of statements
ok github.com/sttk/cliargs/validators 0.886s coverage: 100.0% of statements
Now using version go1.22.12
go version go1.22.12 darwin/amd64
ok github.com/sttk/cliargs 0.316s coverage: 97.6% of statements
ok github.com/sttk/cliargs/errors 0.892s coverage: 100.0% of statements
ok github.com/sttk/cliargs/validators 0.605s coverage: 100.0% of statements
Now using version go1.23.10
go version go1.23.10 darwin/amd64
ok github.com/sttk/cliargs 0.635s coverage: 97.6% of statements
ok github.com/sttk/cliargs/errors 0.310s coverage: 100.0% of statements
ok github.com/sttk/cliargs/validators 0.937s coverage: 100.0% of statements
Now using version go1.24.4
go version go1.24.4 darwin/amd64
ok github.com/sttk/cliargs 0.644s coverage: 97.6% of statements
ok github.com/sttk/cliargs/errors 0.936s coverage: 100.0% of statements
ok github.com/sttk/cliargs/validators 0.319s coverage: 100.0% of statements
Back to go1.24.4
Now using version go1.24.4Copyright (C) 2023-2024 Takayuki Sato
This program is free software under MIT License.
See the file LICENSE in this distribution for more details.