Commits

Zemian Deng committed 5382a5a

Fixed -- parsing.

Comments (0)

Files changed (1)

scripts/issue.groovy

 		def headersSet = ISSUES_HEADERS.toSet()
 		args.each { arg ->
 			def append = true
-			if (arg =~ /--{0,1}\w+/) {
+			if (arg =~ /^--{0,1}\w+/) {
 				options[arg] = true
 				append = false
 			} else if (arg =~ /^\/\w+=.*$/) {
 			}
 		}
 
+		// support short option flag
+		if (options['-d'])
+			options['--details'] = true
+
 		// Run script depending on options passed
-		if (options['--new'] || options['-n']) {
+		if (options['--help'] || options['-h']) {
+			printHelp()
+		} else if (options['--new'] || options['-n']) {
 			createIssue()
 		} else if (options['--update'] || options['-u']) {
 			updateIssue()
 		}
 	}
 
+	def printHelp() {
+		new File(getClass().protectionDomain.codeSource.location.path).withReader{ reader ->
+			def done = false
+			def line = null
+			while (!done && (line = reader.readLine()) != null) {
+				line = line.trim()
+				if (line.startsWith("#") || line.startsWith("//"))
+					println(line)
+				else
+					done = true
+			}
+		}
+	}
+
 	def getDefaultIssuesDir() {	
 		return new File(getClass().protectionDomain.codeSource.location.path).parentFile.path 
 	}