mirror of
https://github.com/jeremyd/ergo.git
synced 2026-07-05 08:08:10 -07:00
minimal who command
This commit is contained in:
+23
-1
@@ -35,6 +35,7 @@ var (
|
||||
"QUIT": NewQuitCommand,
|
||||
"TOPIC": NewTopicCommand,
|
||||
"USER": NewUserMsgCommand,
|
||||
"WHO": NewWhoCommand,
|
||||
"WHOIS": NewWhoisCommand,
|
||||
}
|
||||
)
|
||||
@@ -485,7 +486,7 @@ type WhoisCommand struct {
|
||||
masks []string
|
||||
}
|
||||
|
||||
// [ <target> ] <mask> *( "," <mask> )
|
||||
// WHOIS [ <target> ] <mask> *( "," <mask> )
|
||||
func NewWhoisCommand(args []string) (EditableCommand, error) {
|
||||
if len(args) < 1 {
|
||||
return nil, NotEnoughArgsError
|
||||
@@ -506,3 +507,24 @@ func NewWhoisCommand(args []string) (EditableCommand, error) {
|
||||
masks: strings.Split(masks, ","),
|
||||
}, nil
|
||||
}
|
||||
|
||||
type WhoCommand struct {
|
||||
BaseCommand
|
||||
mask string
|
||||
operatorOnly bool
|
||||
}
|
||||
|
||||
// WHO [ <mask> [ "o" ] ]
|
||||
func NewWhoCommand(args []string) (EditableCommand, error) {
|
||||
cmd := &WhoCommand{}
|
||||
|
||||
if len(args) > 0 {
|
||||
cmd.mask = args[0]
|
||||
}
|
||||
|
||||
if (len(args) > 1) && (args[1] == "o") {
|
||||
cmd.operatorOnly = true
|
||||
}
|
||||
|
||||
return cmd, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user