mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-13 09:57:51 +08:00
d3a31ae193
- Document all flags, and remove doc for removed flags. - Update in-code flag descriptions to be more consistent with the markdown doc.
36 lines
699 B
Go
36 lines
699 B
Go
package prog
|
|
|
|
import "flag"
|
|
|
|
type FlagSet struct {
|
|
*flag.FlagSet
|
|
daemonPaths *DaemonPaths
|
|
json *bool
|
|
}
|
|
|
|
type DaemonPaths struct {
|
|
DB, Sock string
|
|
}
|
|
|
|
func (fs *FlagSet) DaemonPaths() *DaemonPaths {
|
|
if fs.daemonPaths == nil {
|
|
var dp DaemonPaths
|
|
fs.StringVar(&dp.DB, "db", "",
|
|
"[internal flag] Path to the database file")
|
|
fs.StringVar(&dp.Sock, "sock", "",
|
|
"[internal flag] Path to the daemon's UNIX socket")
|
|
fs.daemonPaths = &dp
|
|
}
|
|
return fs.daemonPaths
|
|
}
|
|
|
|
func (fs *FlagSet) JSON() *bool {
|
|
if fs.json == nil {
|
|
var json bool
|
|
fs.BoolVar(&json, "json", false,
|
|
"Show the output from -buildinfo, -compileonly or -version in JSON")
|
|
fs.json = &json
|
|
}
|
|
return fs.json
|
|
}
|