Commits · ampify

tav  ·  dc16d69bdd3471ffe2b6c8204a7311450f7f0434  ·  ampify  ·  github 1311660779

Modified DefaultOpts to not handle help and return runpath.

Changes

src/amp/runtime/runtime.go
......@@ -193,7 +193,7 @@ func InitProcess(name, runPath string) {
193193
 // Process Default Runtime Opts
194194
 // -----------------------------------------------------------------------------
195195
 
196
-func DefaultOpts(name string, opts *optparse.OptionParser, argv []string, consoleFilter logging.Filter) (bool, string) {
196
+func DefaultOpts(name string, opts *optparse.OptionParser, argv []string, consoleFilter logging.Filter) (bool, string, string) {
197197
 
198198
 	var (
199199
 		configPath        string
......@@ -227,16 +227,12 @@ func DefaultOpts(name string, opts *optparse.OptionParser, argv []string, consol
227227
 
228228
 	// Print the default YAML config file if the ``-g`` flag was specified.
229229
 	if *genConfig {
230
-		opts.PrintDefaultConfigFile()
230
+		opts.PrintDefaultConfigFile(name)
231231
 		Exit(0)
232232
 	}
233233
 
234234
 	// Assume the parent directory of the config as the instance directory.
235235
 	if len(args) >= 1 {
236
-		if args[0] == "help" {
237
-			opts.PrintUsage()
238
-			Exit(0)
239
-		}
240236
 		configPath, err = filepath.Abs(filepath.Clean(args[0]))
241237
 		if err != nil {
242238
 			StandardError(err)
......@@ -315,7 +311,7 @@ func DefaultOpts(name string, opts *optparse.OptionParser, argv []string, consol
315311
 	// Initialise the process-related resources.
316312
 	InitProcess(name, runPath)
317313
 
318
-	return *debug, instanceDirectory
314
+	return *debug, instanceDirectory, runPath
319315
 
320316
 }
321317