Asim Shankar | c33b464 | 2014-10-07 00:24:52 -0700 | [diff] [blame^] | 1 | // Package flag provides flag definitions for the suidhelper package. |
| 2 | // |
| 3 | // It does NOT depend on any packages outside the Go standard library. |
| 4 | // This allows veyron.io/veyron/veyron/lib/testutil to depend on this |
| 5 | // package, thereby ensuring that the suidhelper flags are defined |
| 6 | // before the flag.Parse call in testutil.init is made. |
| 7 | // |
| 8 | // This is a hack! This file should go away once testutil.init |
| 9 | // is changed to not parse flags in init(). |
| 10 | // TODO(cnicolaou,ashankar): See above! |
| 11 | package flag |
| 12 | |
| 13 | import "flag" |
| 14 | |
| 15 | var ( |
| 16 | Username, Workspace, StdoutLog, StderrLog, Run *string |
| 17 | MinimumUid *int64 |
| 18 | ) |
| 19 | |
| 20 | func init() { |
| 21 | SetupFlags(flag.CommandLine) |
| 22 | } |
| 23 | |
| 24 | func SetupFlags(fs *flag.FlagSet) { |
| 25 | Username = fs.String("username", "", "The UNIX user name used for the other functions of this tool.") |
| 26 | Workspace = fs.String("workspace", "", "Path to the application's workspace directory.") |
| 27 | StdoutLog = fs.String("stdoutlog", "", "Path to the stdout log file.") |
| 28 | StderrLog = fs.String("stderrlog", "", "Path to the stdin log file.") |
| 29 | Run = fs.String("run", "", "Path to the application to exec.") |
| 30 | MinimumUid = fs.Int64("minuid", uidThreshold, "UIDs cannot be less than this number.") |
| 31 | } |
| 32 | |
| 33 | const uidThreshold = 501 |