Exemple #1
0
func Example() {
	app := cli.NewApp()
	app.Name = "todo"
	app.Usage = "task list on the command line"
	app.Commands = []cli.Command{
		{
			Name:      "add",
			ShortName: "a",
			Usage:     "add a task to the list",
			Action: func(c *cli.Context) {
				println("added task: ", c.Args().First())
			},
		},
		{
			Name:      "complete",
			ShortName: "c",
			Usage:     "complete a task on the list",
			Action: func(c *cli.Context) {
				println("completed task: ", c.Args().First())
			},
		},
	}

	app.Run(os.Args)
}
Exemple #2
0
func ExampleAppSubcommand() {
	// set args for examples sake
	os.Args = []string{"say", "hi", "english", "--name", "Jeremy"}
	app := cli.NewApp()
	app.Name = "say"
	app.Commands = []cli.Command{
		{
			Name:        "hello",
			ShortName:   "hi",
			Usage:       "use it to see a description",
			Description: "This is how we describe hello the function",
			Subcommands: []cli.Command{
				{
					Name:        "english",
					ShortName:   "en",
					Usage:       "sends a greeting in english",
					Description: "greets someone in english",
					Flags: []cli.Flag{
						cli.StringFlag{"name", "Bob", "Name of the person to greet"},
					},
					Action: func(c *cli.Context) {
						fmt.Println("Hello,", c.String("name"))
					},
				},
			},
		},
	}

	app.Run(os.Args)
	// Output:
	// Hello, Jeremy
}
Exemple #3
0
func ExampleAppHelp() {
	// set args for examples sake
	os.Args = []string{"greet", "h", "describeit"}

	app := cli.NewApp()
	app.Name = "greet"
	app.Flags = []cli.Flag{
		cli.StringFlag{Name: "name", Value: "bob", Usage: "a name to say"},
	}
	app.Commands = []cli.Command{
		{
			Name:        "describeit",
			ShortName:   "d",
			Usage:       "use it to see a description",
			Description: "This is how we describe describeit the function",
			Action: func(c *cli.Context) {
				fmt.Printf("i like to describe things")
			},
		},
	}
	app.Run(os.Args)
	// Output:
	// NAME:
	//    describeit - use it to see a description
	//
	// USAGE:
	//    command describeit [command options] [arguments...]
	//
	// DESCRIPTION:
	//    This is how we describe describeit the function
	//
	// OPTIONS:
}
Exemple #4
0
func ExampleAppBashComplete() {
	// set args for examples sake
	os.Args = []string{"greet", "--generate-bash-completion"}

	app := cli.NewApp()
	app.Name = "greet"
	app.EnableBashCompletion = true
	app.Commands = []cli.Command{
		{
			Name:        "describeit",
			ShortName:   "d",
			Usage:       "use it to see a description",
			Description: "This is how we describe describeit the function",
			Action: func(c *cli.Context) {
				fmt.Printf("i like to describe things")
			},
		}, {
			Name:        "next",
			Usage:       "next example",
			Description: "more stuff to see when generating bash completion",
			Action: func(c *cli.Context) {
				fmt.Printf("the next example")
			},
		},
	}

	app.Run(os.Args)
	// Output:
	// describeit
	// d
	// next
	// help
	// h
}
Exemple #5
0
func TestApp_ParseSliceFlags(t *testing.T) {
	var parsedOption, firstArg string
	var parsedIntSlice []int
	var parsedStringSlice []string

	app := cli.NewApp()
	command := cli.Command{
		Name: "cmd",
		Flags: []cli.Flag{
			cli.IntSliceFlag{Name: "p", Value: &cli.IntSlice{}, Usage: "set one or more ip addr"},
			cli.StringSliceFlag{Name: "ip", Value: &cli.StringSlice{}, Usage: "set one or more ports to open"},
		},
		Action: func(c *cli.Context) {
			parsedIntSlice = c.IntSlice("p")
			parsedStringSlice = c.StringSlice("ip")
			parsedOption = c.String("option")
			firstArg = c.Args().First()
		},
	}
	app.Commands = []cli.Command{command}

	app.Run([]string{"", "cmd", "my-arg", "-p", "22", "-p", "80", "-ip", "8.8.8.8", "-ip", "8.8.4.4"})

	IntsEquals := func(a, b []int) bool {
		if len(a) != len(b) {
			return false
		}
		for i, v := range a {
			if v != b[i] {
				return false
			}
		}
		return true
	}

	StrsEquals := func(a, b []string) bool {
		if len(a) != len(b) {
			return false
		}
		for i, v := range a {
			if v != b[i] {
				return false
			}
		}
		return true
	}
	var expectedIntSlice = []int{22, 80}
	var expectedStringSlice = []string{"8.8.8.8", "8.8.4.4"}

	if !IntsEquals(parsedIntSlice, expectedIntSlice) {
		t.Errorf("%s does not match %s", parsedIntSlice, expectedIntSlice)
	}

	if !StrsEquals(parsedStringSlice, expectedStringSlice) {
		t.Errorf("%s does not match %s", parsedStringSlice, expectedStringSlice)
	}
}
Exemple #6
0
func ExampleSubcommand() {
	app := cli.NewApp()
	app.Name = "say"
	app.Commands = []cli.Command{
		{
			Name:        "hello",
			ShortName:   "hi",
			Usage:       "use it to see a description",
			Description: "This is how we describe hello the function",
			Subcommands: []cli.Command{
				{
					Name:        "english",
					ShortName:   "en",
					Usage:       "sends a greeting in english",
					Description: "greets someone in english",
					Flags: []cli.Flag{
						cli.StringFlag{"name", "Bob", "Name of the person to greet"},
					},
					Action: func(c *cli.Context) {
						println("Hello, ", c.String("name"))
					},
				}, {
					Name:      "spanish",
					ShortName: "sp",
					Usage:     "sends a greeting in spanish",
					Flags: []cli.Flag{
						cli.StringFlag{"surname", "Jones", "Surname of the person to greet"},
					},
					Action: func(c *cli.Context) {
						println("Hola, ", c.String("surname"))
					},
				}, {
					Name:      "french",
					ShortName: "fr",
					Usage:     "sends a greeting in french",
					Flags: []cli.Flag{
						cli.StringFlag{"nickname", "Stevie", "Nickname of the person to greet"},
					},
					Action: func(c *cli.Context) {
						println("Bonjour, ", c.String("nickname"))
					},
				},
			},
		}, {
			Name:  "bye",
			Usage: "says goodbye",
			Action: func(c *cli.Context) {
				println("bye")
			},
		},
	}

	app.Run(os.Args)
}
Exemple #7
0
func TestApp_Command(t *testing.T) {
	app := cli.NewApp()
	fooCommand := cli.Command{Name: "foobar", ShortName: "f"}
	batCommand := cli.Command{Name: "batbaz", ShortName: "b"}
	app.Commands = []cli.Command{
		fooCommand,
		batCommand,
	}

	for _, test := range commandAppTests {
		expect(t, app.Command(test.name) != nil, test.expected)
	}
}
Exemple #8
0
func TestApp_Run(t *testing.T) {
	s := ""

	app := cli.NewApp()
	app.Action = func(c *cli.Context) {
		s = s + c.Args().First()
	}

	err := app.Run([]string{"command", "foo"})
	expect(t, err, nil)
	err = app.Run([]string{"command", "bar"})
	expect(t, err, nil)
	expect(t, s, "foobar")
}
Exemple #9
0
func TestApp_Float64Flag(t *testing.T) {
	var meters float64

	app := cli.NewApp()
	app.Flags = []cli.Flag{
		cli.Float64Flag{Name: "height", Value: 1.5, Usage: "Set the height, in meters"},
	}
	app.Action = func(c *cli.Context) {
		meters = c.Float64("height")
	}

	app.Run([]string{"", "--height", "1.93"})
	expect(t, meters, 1.93)
}
Exemple #10
0
func ExampleApp() {
	// set args for examples sake
	os.Args = []string{"greet", "--name", "Jeremy"}

	app := cli.NewApp()
	app.Name = "greet"
	app.Flags = []cli.Flag{
		cli.StringFlag{Name: "name", Value: "bob", Usage: "a name to say"},
	}
	app.Action = func(c *cli.Context) {
		fmt.Printf("Hello %v\n", c.String("name"))
	}
	app.Run(os.Args)
	// Output:
	// Hello Jeremy
}
Exemple #11
0
func TestAppHelpPrinter(t *testing.T) {
	oldPrinter := cli.HelpPrinter
	defer func() {
		cli.HelpPrinter = oldPrinter
	}()

	var wasCalled = false
	cli.HelpPrinter = func(template string, data interface{}) {
		wasCalled = true
	}

	app := cli.NewApp()
	app.Run([]string{"-h"})

	if wasCalled == false {
		t.Errorf("Help printer expected to be called, but was not")
	}
}
Exemple #12
0
func TestCommandDoNotIgnoreFlags(t *testing.T) {
	app := cli.NewApp()
	set := flag.NewFlagSet("test", 0)
	test := []string{"blah", "blah", "-break"}
	set.Parse(test)

	c := cli.NewContext(app, set, set)

	command := cli.Command{
		Name:        "test-cmd",
		ShortName:   "tc",
		Usage:       "this is for testing",
		Description: "testing",
		Action:      func(_ *cli.Context) {},
	}
	err := command.Run(c)

	expect(t, err.Error(), "flag provided but not defined: -break")
}
Exemple #13
0
func TestCommandIgnoreFlags(t *testing.T) {
	app := cli.NewApp()
	set := flag.NewFlagSet("test", 0)
	test := []string{"blah", "blah"}
	set.Parse(test)

	c := cli.NewContext(app, set, set)

	command := cli.Command{
		Name:            "test-cmd",
		ShortName:       "tc",
		Usage:           "this is for testing",
		Description:     "testing",
		Action:          func(_ *cli.Context) {},
		SkipFlagParsing: true,
	}
	err := command.Run(c)

	expect(t, err, nil)
}
Exemple #14
0
func TestApp_CommandWithArgBeforeFlags(t *testing.T) {
	var parsedOption, firstArg string

	app := cli.NewApp()
	command := cli.Command{
		Name: "cmd",
		Flags: []cli.Flag{
			cli.StringFlag{Name: "option", Value: "", Usage: "some option"},
		},
		Action: func(c *cli.Context) {
			parsedOption = c.String("option")
			firstArg = c.Args().First()
		},
	}
	app.Commands = []cli.Command{command}

	app.Run([]string{"", "cmd", "my-arg", "--option", "my-option"})

	expect(t, parsedOption, "my-option")
	expect(t, firstArg, "my-arg")
}
Exemple #15
0
func TestAppCommandNotFound(t *testing.T) {
	beforeRun, subcommandRun := false, false
	app := cli.NewApp()

	app.CommandNotFound = func(c *cli.Context, command string) {
		beforeRun = true
	}

	app.Commands = []cli.Command{
		cli.Command{
			Name: "bar",
			Action: func(c *cli.Context) {
				subcommandRun = true
			},
		},
	}

	app.Run([]string{"command", "foo"})

	expect(t, beforeRun, true)
	expect(t, subcommandRun, false)
}
Exemple #16
0
func main() {

	app := cli.NewApp()
	app.Name = "circuit"
	app.Usage = "Circuit server and client tool"
	app.Commands = []cli.Command{
		// circuit
		{
			Name:   "start",
			Usage:  "Run a circuit worker on this machine",
			Action: server,
			Flags: []cli.Flag{
				cli.StringFlag{"addr, a", "", "address of circuit server"},
				cli.StringFlag{"mutex, m", "", "directory to use as a circuit instance mutex lock"},
				cli.StringFlag{"join, j", "", "join a circuit through a current member by url"},
			},
		},
		{
			Name:   "ls",
			Usage:  "List circuit elements",
			Action: ls,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
			},
		},
		// channel-specific
		{
			Name:   "mkchan",
			Usage:  "Create a channel element",
			Action: mkchan,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
			},
		},
		{
			Name:   "send",
			Usage:  "Send data to the channel from standard input",
			Action: send,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
			},
		},
		{
			Name:   "recv",
			Usage:  "Receive data from the channel on stadard output",
			Action: recv,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
			},
		},
		{
			Name:   "close",
			Usage:  "Close the channel after all current transmissions complete",
			Action: clos,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
			},
		},
		// common
		{
			Name:   "scrub",
			Usage:  "Abort and remove an element",
			Action: scrb,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
			},
		},
		{
			Name:   "peek",
			Usage:  "Query element state asynchronously",
			Action: peek,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
			},
		},
		// proc-specific
		{
			Name:   "mkproc",
			Usage:  "Create a process element",
			Action: mkproc,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
			},
		},
		{
			Name:   "signal",
			Usage:  "Send a signal to a running process",
			Action: sgnl,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
			},
		},
		{
			Name:   "wait",
			Usage:  "Wait until a process exits",
			Action: wait,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
			},
		},
		// stdin, stdout, stderr
		{
			Name:   "stdin",
			Usage:  "Forward this tool's standard input to that of the process",
			Action: stdin,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
			},
		},
		{
			Name:   "stdout",
			Usage:  "Forward the standard output of the process to the standard output of this tool",
			Action: stdout,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
			},
		},
		{
			Name:   "stderr",
			Usage:  "Forward the standard error of the process to the standard output of this tool",
			Action: stderr,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
			},
		},
	}
	app.Run(os.Args)
}
Exemple #17
0
func TestApp_BeforeFunc(t *testing.T) {
	beforeRun, subcommandRun := false, false
	beforeError := fmt.Errorf("fail")
	var err error

	app := cli.NewApp()

	app.Before = func(c *cli.Context) error {
		beforeRun = true
		s := c.String("opt")
		if s == "fail" {
			return beforeError
		}

		return nil
	}

	app.Commands = []cli.Command{
		cli.Command{
			Name: "sub",
			Action: func(c *cli.Context) {
				subcommandRun = true
			},
		},
	}

	app.Flags = []cli.Flag{
		cli.StringFlag{Name: "opt"},
	}

	// run with the Before() func succeeding
	err = app.Run([]string{"command", "--opt", "succeed", "sub"})

	if err != nil {
		t.Fatalf("Run error: %s", err)
	}

	if beforeRun == false {
		t.Errorf("Before() not executed when expected")
	}

	if subcommandRun == false {
		t.Errorf("Subcommand not executed when expected")
	}

	// reset
	beforeRun, subcommandRun = false, false

	// run with the Before() func failing
	err = app.Run([]string{"command", "--opt", "fail", "sub"})

	// should be the same error produced by the Before func
	if err != beforeError {
		t.Errorf("Run error expected, but not received")
	}

	if beforeRun == false {
		t.Errorf("Before() not executed when expected")
	}

	if subcommandRun == true {
		t.Errorf("Subcommand executed when NOT expected")
	}

}
Exemple #18
0
func main() {

	app := cli.NewApp()
	app.Name = "circuit"
	app.Usage = "Circuit server and client tool"
	app.Commands = []cli.Command{
		// circuit
		{
			Name:   "start",
			Usage:  "Run a circuit worker on this machine",
			Action: server,
			Flags: []cli.Flag{
				cli.StringFlag{"addr, a", "0.0.0.0:0", "Address of circuit server."},
				cli.StringFlag{"if", "", "Bind any available port on the specified interface."},
				cli.StringFlag{"var", "", "Lock and log directory for the circuit server."},
				cli.StringFlag{"join, j", "", "Join a circuit through a current member by address."},
				cli.StringFlag{"hmac", "", "File with HMAC credentials for HMAC/RC4 transport security."},
				cli.StringFlag{"discover", "228.8.8.8:8822", "Multicast address for peer server discovery"},
				cli.BoolFlag{"docker", "Enable docker elements; docker command must be executable"},
			},
		},
		{
			Name:   "keygen",
			Usage:  "Generate a new random HMAC key",
			Action: keygen,
		},
		{
			Name:   "ls",
			Usage:  "List circuit elements",
			Action: ls,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
				cli.StringFlag{"discover", "228.8.8.8:8822", "Multicast address for peer server discovery"},
				cli.BoolFlag{"long, l", "show detailed anchor information"},
				cli.BoolFlag{"depth, de", "traverse anchors in depth-first order (leaves first)"},
				cli.StringFlag{"hmac", "", "File containing HMAC credentials. Use RC4 encryption."},
			},
		},
		// subscription-specific
		{
			Name:   "mk@join",
			Usage:  "Create a subscription element, receiving server join events",
			Action: mkonjoin,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
				cli.StringFlag{"discover", "228.8.8.8:8822", "Multicast address for peer server discovery"},
				cli.StringFlag{"hmac", "", "File containing HMAC credentials. Use RC4 encryption."},
			},
		},
		{
			Name:   "mk@leave",
			Usage:  "Create a subscription element, receiving server leave events",
			Action: mkonleave,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
				cli.StringFlag{"discover", "228.8.8.8:8822", "Multicast address for peer server discovery"},
				cli.StringFlag{"hmac", "", "File containing HMAC credentials. Use RC4 encryption."},
			},
		},
		// server-specific
		{
			Name:   "stk",
			Usage:  "Print the runtime stack trace of a server element",
			Action: stack,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
				cli.StringFlag{"discover", "228.8.8.8:8822", "Multicast address for peer server discovery"},
				cli.StringFlag{"hmac", "", "File containing HMAC credentials. Use RC4 encryption."},
			},
		},
		{
			Name:   "join",
			Usage:  "Merge the networks of this circuit server and that of the argument circuit address",
			Action: join,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
				cli.StringFlag{"discover", "228.8.8.8:8822", "Multicast address for peer server discovery"},
				cli.StringFlag{"hmac", "", "File containing HMAC credentials. Use RC4 encryption."},
			},
		},
		{
			Name:   "suicide",
			Usage:  "Kill a chosen circuit daemon",
			Action: stack,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
				cli.StringFlag{"discover", "228.8.8.8:8822", "Multicast address for peer server discovery"},
				cli.StringFlag{"hmac", "", "File containing HMAC credentials. Use RC4 encryption."},
			},
		},
		// channel-specific
		{
			Name:   "mkchan",
			Usage:  "Create a channel element",
			Action: mkchan,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
				cli.StringFlag{"discover", "228.8.8.8:8822", "Multicast address for peer server discovery"},
				cli.StringFlag{"hmac", "", "File containing HMAC credentials. Use RC4 encryption."},
			},
		},
		{
			Name:   "send",
			Usage:  "Send data to the channel from standard input",
			Action: send,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
				cli.StringFlag{"discover", "228.8.8.8:8822", "Multicast address for peer server discovery"},
				cli.StringFlag{"hmac", "", "File containing HMAC credentials. Use RC4 encryption."},
			},
		},
		{
			Name:   "recv",
			Usage:  "Receive data from a channel or a subscription on stadard output",
			Action: recv,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
				cli.StringFlag{"discover", "228.8.8.8:8822", "Multicast address for peer server discovery"},
				cli.StringFlag{"hmac", "", "File containing HMAC credentials. Use RC4 encryption."},
			},
		},
		{
			Name:   "close",
			Usage:  "Close the channel after all current transmissions complete",
			Action: clos,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
				cli.StringFlag{"discover", "228.8.8.8:8822", "Multicast address for peer server discovery"},
				cli.StringFlag{"hmac", "", "File containing HMAC credentials. Use RC4 encryption."},
			},
		},
		// common
		{
			Name:   "scrub",
			Usage:  "Abort and remove an element",
			Action: scrb,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
				cli.StringFlag{"discover", "228.8.8.8:8822", "Multicast address for peer server discovery"},
				cli.StringFlag{"hmac", "", "File containing HMAC credentials. Use RC4 encryption."},
			},
		},
		{
			Name:   "peek",
			Usage:  "Query element state asynchronously",
			Action: peek,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
				cli.StringFlag{"discover", "228.8.8.8:8822", "Multicast address for peer server discovery"},
				cli.StringFlag{"hmac", "", "File containing HMAC credentials. Use RC4 encryption."},
			},
		},
		// nameserver
		{
			Name:   "mkdns",
			Usage:  "Create a nameserver element",
			Action: mkdns,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
				cli.StringFlag{"discover", "228.8.8.8:8822", "Multicast address for peer server discovery"},
				cli.StringFlag{"hmac", "", "File containing HMAC credentials. Use RC4 encryption."},
			},
		},
		{
			Name:   "set",
			Usage:  "Set a resource record in a nameserver element",
			Action: nset,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
				cli.StringFlag{"discover", "228.8.8.8:8822", "Multicast address for peer server discovery"},
				cli.StringFlag{"hmac", "", "File containing HMAC credentials. Use RC4 encryption."},
			},
		},
		{
			Name:   "unset",
			Usage:  "Remove all resource records for a name in a nameserver element",
			Action: nunset,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
				cli.StringFlag{"discover", "228.8.8.8:8822", "Multicast address for peer server discovery"},
				cli.StringFlag{"hmac", "", "File containing HMAC credentials. Use RC4 encryption."},
			},
		},
		// proc/dkr-specific
		{
			Name:   "mkdkr",
			Usage:  "Create a docker container element",
			Action: mkdkr,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
				cli.StringFlag{"discover", "228.8.8.8:8822", "Multicast address for peer server discovery"},
				cli.BoolFlag{"scrub", "scrub the process anchor automatically on exit"},
				cli.StringFlag{"hmac", "", "File containing HMAC credentials. Use RC4 encryption."},
			},
		},
		{
			Name:   "mkproc",
			Usage:  "Create a process element",
			Action: mkproc,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
				cli.StringFlag{"discover", "228.8.8.8:8822", "Multicast address for peer server discovery"},
				cli.BoolFlag{"scrub", "scrub the process anchor automatically on exit"},
				cli.StringFlag{"hmac", "", "File containing HMAC credentials. Use RC4 encryption."},
			},
		},
		{
			Name:   "signal",
			Usage:  "Send a signal to a running process",
			Action: sgnl,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
				cli.StringFlag{"discover", "228.8.8.8:8822", "Multicast address for peer server discovery"},
				cli.StringFlag{"hmac", "", "File containing HMAC credentials. Use RC4 encryption."},
			},
		},
		{
			Name:   "wait",
			Usage:  "Wait until a process exits",
			Action: wait,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
				cli.StringFlag{"discover", "228.8.8.8:8822", "Multicast address for peer server discovery"},
				cli.StringFlag{"hmac", "", "File containing HMAC credentials. Use RC4 encryption."},
			},
		},
		{
			Name:   "waitall",
			Usage:  "Wait until a set of processes all exit",
			Action: waitall,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
				cli.StringFlag{"discover", "228.8.8.8:8822", "Multicast address for peer server discovery"},
				cli.StringFlag{"hmac", "", "File containing HMAC credentials. Use RC4 encryption."},
			},
		},
		// stdin, stdout, stderr
		{
			Name:   "stdin",
			Usage:  "Forward this tool's standard input to that of the process",
			Action: stdin,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
				cli.StringFlag{"discover", "228.8.8.8:8822", "Multicast address for peer server discovery"},
				cli.StringFlag{"hmac", "", "File containing HMAC credentials. Use RC4 encryption."},
			},
		},
		{
			Name:   "stdout",
			Usage:  "Forward the standard output of the process to the standard output of this tool",
			Action: stdout,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
				cli.StringFlag{"discover", "228.8.8.8:8822", "Multicast address for peer server discovery"},
				cli.StringFlag{"hmac", "", "File containing HMAC credentials. Use RC4 encryption."},
			},
		},
		{
			Name:   "stderr",
			Usage:  "Forward the standard error of the process to the standard output of this tool",
			Action: stderr,
			Flags: []cli.Flag{
				cli.StringFlag{"dial, d", "", "circuit member to dial into"},
				cli.StringFlag{"discover", "228.8.8.8:8822", "Multicast address for peer server discovery"},
				cli.StringFlag{"hmac", "", "File containing HMAC credentials. Use RC4 encryption."},
			},
		},
	}
	app.Run(os.Args)
}