mirror of
https://github.com/supleed2/go-chat.git
synced 2024-12-22 14:15: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
|
||||
|
||||
- Version flag for client and server binaries
|
||||
- Description in help output of client and server binaries
|
||||
|
||||
### Changed
|
||||
|
||||
### Deprecated
|
||||
|
|
|
@ -73,6 +73,13 @@ type args struct {
|
|||
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() {
|
||||
ctx := context.Background()
|
||||
|
||||
|
|
|
@ -41,15 +41,25 @@ type server struct {
|
|||
nickm map[string]string
|
||||
}
|
||||
|
||||
func main() {
|
||||
log := log.New(os.Stderr, "ws server 🚀 ", log.LstdFlags|log.Lshortfile|log.Lmsgprefix)
|
||||
|
||||
var args struct {
|
||||
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() {
|
||||
log := log.New(os.Stderr, "ws server 🚀 ", log.LstdFlags|log.Lshortfile|log.Lmsgprefix)
|
||||
|
||||
var args args
|
||||
arg.MustParse(&args)
|
||||
|
||||
nickMap, err := loadNickMap(args.NickMap)
|
||||
|
|
Loading…
Reference in a new issue