mirror of
https://github.com/luscis/openlan.git
synced 2025-11-02 21:34:00 +08:00
fea: openlan: list users filter by network
This commit is contained in:
@@ -34,6 +34,16 @@ func (u Link) List(c *cli.Context) error {
|
||||
if err := clt.GetJSON(url, &items); err != nil {
|
||||
return err
|
||||
}
|
||||
name := c.String("network")
|
||||
if len(name) > 0 {
|
||||
tmp := items[:0]
|
||||
for _, obj := range items {
|
||||
if obj.Network == name {
|
||||
tmp = append(tmp, obj)
|
||||
}
|
||||
}
|
||||
items = tmp
|
||||
}
|
||||
return u.Out(items, c.String("format"), u.Tmpl())
|
||||
}
|
||||
|
||||
@@ -47,7 +57,10 @@ func (u Link) Commands(app *api.App) {
|
||||
Name: "list",
|
||||
Usage: "Display all links",
|
||||
Aliases: []string{"ls"},
|
||||
Action: u.List,
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{Name: "network"},
|
||||
},
|
||||
Action: u.List,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user