github.com/cloudfoundry-attic/garden-linux@v0.333.2-candidate/integration/helpers/capcheck/main_linux.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  
     7  	"strings"
     8  
     9  	"github.com/cloudfoundry-incubator/garden-linux/integration/helpers/capcheck/commands"
    10  )
    11  
    12  const HELP_SUBCOMMAND = "help"
    13  
    14  func main() {
    15  	args := os.Args
    16  	if len(args) == 2 && args[1] == HELP_SUBCOMMAND {
    17  		fmt.Println("Capability Help:")
    18  		fmt.Printf("  Usage: %s <CAPABILITY<,...>>\n", args[0])
    19  		fmt.Printf("  Example: %s CAP_CHOWN,CAP_NET_BIND_SERVICE\n\n", args[0])
    20  		return
    21  	}
    22  
    23  	caps := make(map[string]bool, 0)
    24  	if len(args) == 2 {
    25  		capsList := args[1]
    26  		for _, cap := range strings.Split(capsList, ",") {
    27  			caps[cap] = true
    28  		}
    29  	}
    30  
    31  	commands.Inspect(caps)
    32  }