mirror of
https://github.com/supleed2/go-chat.git
synced 2024-12-22 22:25:49 +00:00
Version and Description in help output
This commit is contained in:
parent
f4afdce578
commit
4bd33daafe
|
@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
- Version flag for client and server binaries
|
||||||
|
- Description in help output of client and server binaries
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
|
@ -73,6 +73,13 @@ type args struct {
|
||||||
Password *string `arg:"-p" help:"password, if required"`
|
Password *string `arg:"-p" help:"password, if required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *args) Version() string {
|
||||||
|
return "v0.1.2"
|
||||||
|
}
|
||||||
|
func (a *args) Description() string {
|
||||||
|
return "Go, chat!\nA basic irc-style chat client, written in Go using bubbletea and websockets"
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
|
|
|
@ -41,15 +41,25 @@ type server struct {
|
||||||
nickm map[string]string
|
nickm map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type args struct {
|
||||||
|
Admin string `arg:"-a" default:"8bit" help:"admin user nick, allows access to /sudo" placeholder:"NICK"`
|
||||||
|
HistLen uint `arg:"-l" default:"10" help:"set message history size" placeholder:"N"`
|
||||||
|
Port uint `arg:"positional" default:"0" help:"port to listen on, random available port if not set"`
|
||||||
|
NickMap *string `arg:"-n" help:"path to nick:pass JSON file" placeholder:"FILE"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *args) Version() string {
|
||||||
|
return "v0.1.2"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *args) Description() string {
|
||||||
|
return "Go, chat! Server\nA basic irc-style chat server, written in Go using websockets"
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
log := log.New(os.Stderr, "ws server 🚀 ", log.LstdFlags|log.Lshortfile|log.Lmsgprefix)
|
log := log.New(os.Stderr, "ws server 🚀 ", log.LstdFlags|log.Lshortfile|log.Lmsgprefix)
|
||||||
|
|
||||||
var args struct {
|
var args args
|
||||||
Admin string `arg:"-a" default:"8bit" help:"admin user nick, allows access to /sudo" placeholder:"NICK"`
|
|
||||||
HistLen uint `arg:"-l" default:"10" help:"set message history size" placeholder:"N"`
|
|
||||||
Port uint `arg:"positional" default:"0" help:"port to listen on, random available port if not set"`
|
|
||||||
NickMap *string `arg:"-n" help:"path to nick:pass JSON file" placeholder:"FILE"`
|
|
||||||
}
|
|
||||||
arg.MustParse(&args)
|
arg.MustParse(&args)
|
||||||
|
|
||||||
nickMap, err := loadNickMap(args.NickMap)
|
nickMap, err := loadNickMap(args.NickMap)
|
||||||
|
|
Loading…
Reference in a new issue