mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-03 07:12:27 +00:00
Add --device flag to filter pending folders.
This commit is contained in:
parent
80d4bc1cea
commit
7b0fbb6fef
@ -7,6 +7,8 @@
|
|||||||
package cli
|
package cli
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -21,9 +23,23 @@ var pendingCommand = cli.Command{
|
|||||||
Action: expects(0, indexDumpOutput("cluster/pending/devices")),
|
Action: expects(0, indexDumpOutput("cluster/pending/devices")),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "folders",
|
Name: "folders",
|
||||||
Usage: "Show pending folders",
|
Usage: "Show pending folders",
|
||||||
Action: expects(0, indexDumpOutput("cluster/pending/folders")),
|
Flags: []cli.Flag{
|
||||||
|
cli.StringFlag{Name: "device", Usage: "Show pending folders offered by given device"},
|
||||||
|
},
|
||||||
|
Action: expects(0, folders()),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func folders() cli.ActionFunc {
|
||||||
|
return func(c *cli.Context) error {
|
||||||
|
if c.String("device") != "" {
|
||||||
|
query := make(url.Values)
|
||||||
|
query.Set("device", c.String("device"))
|
||||||
|
return indexDumpOutput("cluster/pending/folders?" + query.Encode())(c)
|
||||||
|
}
|
||||||
|
return indexDumpOutput("cluster/pending/folders")(c)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user