11package io .joern .x2cpg
22
33import io .joern .x2cpg .X2Cpg .{applyDefaultOverlays , withErrorsToConsole }
4- import io .joern .x2cpg .frontendspecific .FrontendArgsDelimitor
54import io .joern .x2cpg .layers .{Base , CallGraph , ControlFlow , TypeRelations }
65import io .shiftleft .codepropertygraph .generated .Cpg
76import io .shiftleft .semanticcpg .layers .{LayerCreator , LayerCreatorContext }
87import io .shiftleft .semanticcpg .utils .FileUtil
98import org .slf4j .LoggerFactory
10- import scopt .OParser
9+ import scopt .{ DefaultOParserSetup , OParser , OParserSetup }
1110
1211import java .io .PrintWriter
1312import java .nio .file .{Files , Paths }
@@ -262,6 +261,10 @@ object X2Cpg {
262261
263262 private val logger = LoggerFactory .getLogger(X2Cpg .getClass)
264263
264+ private val oParserSetup : OParserSetup = new DefaultOParserSetup {
265+ override def showUsageOnError : Option [Boolean ] = Some (true )
266+ }
267+
265268 /** Parse commands line arguments in `args` using an X2Cpg command line parser, extended with the frontend specific
266269 * options in `frontendSpecific` with the initial configuration set to `initialConf`. On success, the configuration
267270 * is returned wrapped into an Option. On failure, error messages are printed and, `None` is returned.
@@ -272,7 +275,7 @@ object X2Cpg {
272275 initialConf : R
273276 ): Option [R ] = {
274277 val parser = commandLineParser(frontendSpecific)
275- OParser .parse(parser, args, initialConf)
278+ OParser .parse(parser, args, initialConf, oParserSetup )
276279 }
277280
278281 /** Create a command line parser that can be extended to add options specific for the frontend.
0 commit comments