-
-
Save kenenbek/adae85792f38192689c79a2b3a66a2ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
) | |
type stringFlag struct { | |
set bool | |
value string | |
} | |
func (sf *stringFlag) Set(x string) error { | |
sf.value = x | |
sf.set = true | |
return nil | |
} | |
func (sf *stringFlag) String() string { | |
return sf.value | |
} | |
func init() { | |
} | |
// platformFileName — topology/platform.xml | |
// deploymentFileName — topology/deployment.xml | |
// fileSizeRange — 5MB..100MB | |
// fileTimeRange — 1s..2s | |
// anomalyType — VESNIN1FAIL | |
// anomalyNumber — 5 | |
// anomalyTimeRange — 20s..30s | |
func main() { | |
var plaformFileName stringFlag | |
var deploymentFileName stringFlag | |
var fileSizeRange stringFlag | |
var fileTimeRange stringFlag | |
var anomalyType stringFlag | |
var anomalyNumber stringFlag | |
var anomalyTimeRange stringFlag | |
flag.Var(&plaformFileName, "platform", "the filename") | |
flag.Var(&deploymentFileName, "deployment", "the filename") | |
flag.Var(&fileSizeRange, "deployment", "the filename") | |
flag.Var(&fileTimeRange, "deployment", "the filename") | |
flag.Var(&anomalyType, "deployment", "the filename") | |
flag.Var(&anomalyNumber, "deployment", "the filename") | |
flag.Var(&anomalyType, "deployment", "the filename") | |
flag.Var(&anomalyTimeRange, "deployment", "the filename") | |
flag.Parse() | |
if !plaformFileName.set || !deploymentFileName.set { | |
panic("platform or deployment not set") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment