File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,8 +9,11 @@ import (
99 "github.com/urfave/cli"
1010)
1111
12+ // Command holds data for the cli commands.
1213type Command struct {}
1314
15+ // GetLogger returns a logrus object according to any flags set
16+ // in the application parameters.
1417func (c Command ) GetLogger (cli * cli.Context ) * log.Logger {
1518 if cli .GlobalBool ("quiet" ) {
1619 logger , _ := test .NewNullLogger ()
@@ -33,6 +36,7 @@ func (c Command) GetLogger(cli *cli.Context) *log.Logger {
3336 return log .StandardLogger ()
3437}
3538
39+ // GetBeanstalkdClient returns a client object for interacting with a beanstalkd server.
3640func (c Command ) GetBeanstalkdClient (cli * cli.Context ) (* beanstalkd.BeanstalkdClient , error ) {
3741 // Build a connection string.
3842 addr := fmt .Sprintf ("%s:%d" , cli .GlobalString ("server" ), cli .GlobalInt ("port" ))
Original file line number Diff line number Diff line change 55 "github.com/urfave/cli"
66)
77
8+ // Flush empties an entire tube of jobs.
89func (c * Command ) Flush (cli * cli.Context ) {
910 log := c .GetLogger (cli )
1011
Original file line number Diff line number Diff line change @@ -3,8 +3,9 @@ package command
33import (
44 "bytes"
55 "fmt"
6- "github.com/urfave/cli"
76 "time"
7+
8+ "github.com/urfave/cli"
89)
910
1011var (
2425 }
2526)
2627
28+ // Monitor outputs a overview of server and tube statistics, repeated every second.
2729func (c * Command ) Monitor (cli * cli.Context ) {
2830 log := c .GetLogger (cli )
2931
Original file line number Diff line number Diff line change @@ -2,9 +2,11 @@ package command
22
33import (
44 "fmt"
5+
56 "github.com/urfave/cli"
67)
78
9+ // Peek displays the next job in the tube without removing it.
810func (c * Command ) Peek (cli * cli.Context ) {
911 log := c .GetLogger (cli )
1012
Original file line number Diff line number Diff line change @@ -2,10 +2,12 @@ package command
22
33import (
44 "fmt"
5+
56 "github.com/sirupsen/logrus"
67 "github.com/urfave/cli"
78)
89
10+ // Pop removes and displays a job from the selected tube.
911func (c * Command ) Pop (cli * cli.Context ) {
1012 log := c .GetLogger (cli )
1113
Original file line number Diff line number Diff line change 88 "github.com/urfave/cli"
99)
1010
11+ // Put adds a new job into a queue, from a string or reading from stdin.
1112func (c * Command ) Put (cli * cli.Context ) {
1213 log := c .GetLogger (cli )
1314
You can’t perform that action at this time.
0 commit comments