Use the directory name as the default application name
@@ -129,10 +129,13 @@ func (o *ExperimentOptions) generate() error {
}
}
- // Make sure there is an explicit namespace
+ // Make sure there is an explicit namespace and name
if g.Application.Namespace == "" {
g.Application.Namespace = o.defaultNamespace()
}
+ if g.Application.Name == "" {
+ g.Application.Name = o.defaultName()
+ }
// Generate the experiment
list, err := g.Generate()
@@ -180,3 +183,15 @@ func (o *ExperimentOptions) defaultNamespace() string {
// We cannot return empty, use default
return "default"
}
+
+func (o *ExperimentOptions) defaultName() string {
+ // Use the directory name
+ if af, err := filepath.Abs(o.Filename); err == nil {
+ if d := filepath.Base(filepath.Dir(af)); d != "." {
+ return d
+ }
+ }
+
+ // We cannot return empty, use default
+ return "default"
+}
