stevedlawrence commented on a change in pull request #557:
URL: https://github.com/apache/daffodil/pull/557#discussion_r630106044
##########
File path: daffodil-cli/src/main/scala/org/apache/daffodil/Main.scala
##########
@@ -319,40 +319,39 @@ class CLIConf(arguments: Array[String]) extends
scallop.ScallopConf(arguments)
shortSubcommandsHelp()
// Global Options
- val debug = opt[Option[String]](argName = "file", descr = "enable debugging.
Optionally, read initial debugger commands from [file] if
provided.")(optionalValueConverter[String](a => a))
- val trace = opt[Boolean](descr = "run the debugger with verbose trace
output")
- val verbose = tally(descr = "increment verbosity level, one level for each
-v")
- val version = opt[Boolean](descr = "Show version of this program")
+ val debug = opt[Option[String]](argName = "file", descr = "Enable the
interactive debugger. Optionally, read initial debugger commands from [file] if
provided.")(optionalValueConverter[String](a => a))
+ val trace = opt[Boolean](descr = "Run this program with verbose trace
output")
+ val verbose = tally(descr = "Increment verbosity level, one level for each
-v")
+ val version = opt[Boolean](descr = "Show Daffodil's version")
// Parse Subcommand Options
object parse extends scallop.Subcommand("parse") {
- banner("""|Usage: daffodil parse (-s <schema> [-r [{namespace}]<root>] [-p
<path>] |
+ banner("""|Usage: daffodil parse (-s <schema> [-r [{<namespace>}]<root>]
[-p <path>] |
Review comment:
The square bracket, curly brace, and angle bracket is kind of hard to
visiaully parse. Also, I think the standard is to use square brackets for
optional things and angle brackets for required things, so I'm not sure the
namespace is right. But the curly braces are also a bit confusing.
Maybe to simplify this and make it easier to visually parse, I wonder if we
should just make this `-r <root>`. And then the help for the root option can
describe the syntax (e.g. root element name, optionally preceeded by namespace
surrounded in curly braces). Rarely do you actually need the namespace so it's
probably not worth complicating the overview of options for this one rarely
used feature.
If we do make this change, we should also do it any other time we allow a
namespace to be specified. I think maybe the only other place is with the `-D`
for variable names?
##########
File path: daffodil-cli/src/main/scala/org/apache/daffodil/Main.scala
##########
@@ -319,40 +319,39 @@ class CLIConf(arguments: Array[String]) extends
scallop.ScallopConf(arguments)
shortSubcommandsHelp()
// Global Options
- val debug = opt[Option[String]](argName = "file", descr = "enable debugging.
Optionally, read initial debugger commands from [file] if
provided.")(optionalValueConverter[String](a => a))
- val trace = opt[Boolean](descr = "run the debugger with verbose trace
output")
- val verbose = tally(descr = "increment verbosity level, one level for each
-v")
- val version = opt[Boolean](descr = "Show version of this program")
+ val debug = opt[Option[String]](argName = "file", descr = "Enable the
interactive debugger. Optionally, read initial debugger commands from [file] if
provided.")(optionalValueConverter[String](a => a))
+ val trace = opt[Boolean](descr = "Run this program with verbose trace
output")
+ val verbose = tally(descr = "Increment verbosity level, one level for each
-v")
+ val version = opt[Boolean](descr = "Show Daffodil's version")
Review comment:
I don't feel strongly about this, but looking at a handful of common
linux tools, it seems the standard is to start option descriptions with a lower
case character.
##########
File path: daffodil-cli/src/main/scala/org/apache/daffodil/Main.scala
##########
@@ -458,53 +413,94 @@ class CLIConf(arguments: Array[String]) extends
scallop.ScallopConf(arguments)
}
}
- // Save Subcommand Options
+ // Save Parser Subcommand Options
object save extends scallop.Subcommand("save-parser") {
- banner("""|Usage: daffodil save-parser -s <schema> [-r [{namespace}]<root>]
- | [-p <path>]
- |
[-D[{namespace}]<variable>=<value>...]
- | [-c <file>] [outfile]
+ banner("""|Usage: daffodil save-parser -s <schema> [-r
[{<namespace>}]<root>] [-p <path>]
+ |
[-D[{<namespace>}]<variable>=<value>...] [-c <file>]
+ | [outfile]
|
|Create and save a parser using a DFDL schema
|
|Save Parser Options:""".stripMargin)
- descr("save a daffodil parser for reuse")
+ descr("Save a Daffodil parser for reuse")
helpWidth(76)
- val schema = opt[URI]("schema", argName = "file", required = true, descr =
"the annotated DFDL schema to use to create the
parser.")(fileResourceURIConverter)
- val rootNS = opt[RefQName]("root", argName = "node", descr = "the root
element of the XML file to use. An optional namespace may be provided. This
needs to be one of the top-level elements of the DFDL schema defined with
--schema. Requires --schema. If not supplied uses the first element of the
first schema")
- val path = opt[String](argName = "path", descr = "path to the node to
create parser.")
- val outfile = trailArg[String](required = false, descr = "output file to
save parser. If not specified, or a value of -, writes to stdout.")
- val vars = props[String]('D', keyName = "variable", valueName = "value",
descr = "variables to be used.")
- val tunables = props[String]('T', keyName = "tunable", valueName =
"value", descr = "daffodil tunable to be used when parsing.")
- val config = opt[File](short = 'c', argName = "file", descr = "path to
file containing configuration items.")
+ val config = opt[File](short = 'c', argName = "file", descr = "Path to XML
file containing configuration items")
+ val vars = props[String]('D', keyName = "variable", valueName = "value",
descr = "Variables to be used when parsing. An optional namespace may be
provided.")
+ val path = opt[String](argName = "path", descr = "Path from root element
to node from which to start parsing")
+ val rootNS = opt[RefQName]("root", argName = "node", descr = "The root
element to use. An optional namespace may be provided. This must be one of the
top-level elements of the DFDL schema defined with --schema. Requires --schema.
If not supplied, uses schema's first top-level element.")
+ val schema = opt[URI]("schema", argName = "file", required = true, descr =
"The annotated DFDL schema to use to create the
parser")(fileResourceURIConverter)
+ val tunables = props[String]('T', keyName = "tunable", valueName =
"value", descr = "Tunable configuration options to change Daffodil's behavior")
+
+ val outfile = trailArg[String](required = false, descr = "Output file to
save parser to. If not specified, or a value of -, saves to stdout.")
requireOne(schema) // --schema must be provided
validateFileIsFile(config) // --config must be a file that exists
}
// Test Subcommand Options
object test extends scallop.Subcommand("test") {
- banner("""|Usage: daffodil test <tdmlfile> [testname...]
+ banner("""|Usage: daffodil test [-l] [-r] [-i] <tdmlfile> [testname...]
|
|List or execute tests in a TDML file
|
|Test Options:""".stripMargin)
- descr("list or execute TDML tests")
+ descr("List or execute TDML tests")
helpWidth(76)
- val list = opt[Boolean](descr = "show names and descriptions instead of
running test cases.")
- val regex = opt[Boolean](descr = "treat <names> as regular expressions.")
- val tdmlfile = trailArg[String](required = true, descr = "test data markup
language (TDML) file.")
- val names = trailArg[List[String]](required = false, descr = "name of test
case(s) in tdml file. If not given, all tests in tdmlfile are run.")
- val info = tally(descr = "increment test result information output level,
one level for each -i")
+ val info = tally(descr = "Increment test result information output level,
one level for each -i")
+ val list = opt[Boolean](descr = "Show names and descriptions instead of
running test cases")
+ val regex = opt[Boolean](descr = "Treat <testname...> as regular
expressions")
+ val tdmlfile = trailArg[String](required = true, descr = "Test Data Markup
Language (TDML) file")
+ val names = trailArg[List[String]](required = false, descr = "Name(s) of
test cases in tdmlfile. If not given, all tests in tdmlfile are run.")
Review comment:
The banner testname but the help is going to say "names". We should make
that consistent while we are changing things.
##########
File path: daffodil-cli/src/main/scala/org/apache/daffodil/Main.scala
##########
@@ -319,40 +319,39 @@ class CLIConf(arguments: Array[String]) extends
scallop.ScallopConf(arguments)
shortSubcommandsHelp()
// Global Options
- val debug = opt[Option[String]](argName = "file", descr = "enable debugging.
Optionally, read initial debugger commands from [file] if
provided.")(optionalValueConverter[String](a => a))
- val trace = opt[Boolean](descr = "run the debugger with verbose trace
output")
- val verbose = tally(descr = "increment verbosity level, one level for each
-v")
- val version = opt[Boolean](descr = "Show version of this program")
+ val debug = opt[Option[String]](argName = "file", descr = "Enable the
interactive debugger. Optionally, read initial debugger commands from [file] if
provided.")(optionalValueConverter[String](a => a))
+ val trace = opt[Boolean](descr = "Run this program with verbose trace
output")
+ val verbose = tally(descr = "Increment verbosity level, one level for each
-v")
+ val version = opt[Boolean](descr = "Show Daffodil's version")
// Parse Subcommand Options
object parse extends scallop.Subcommand("parse") {
- banner("""|Usage: daffodil parse (-s <schema> [-r [{namespace}]<root>] [-p
<path>] |
+ banner("""|Usage: daffodil parse (-s <schema> [-r [{<namespace>}]<root>]
[-p <path>] |
| -P <parser>)
- | [--validate [mode]]
- | [-D[{namespace}]<variable>=<value>...]
[-o <output>]
- | [-I <infoset_type>]
- | [--stream]
- | [-c <file>] [infile]
+ | [-D[{<namespace>}]<variable>=<value>...]
[-o <output>]
+ | [-V [mode]] [--stream] [-I
<infoset_type>] [-c <file>]
+ | [infile]
|
|Parse a file, using either a DFDL schema or a saved parser
|
|Parse Options:""".stripMargin)
- descr("parse data to a DFDL infoset")
+ descr("Parse data to a DFDL infoset")
helpWidth(76)
- val schema = opt[URI]("schema", argName = "file", descr = "the annotated
DFDL schema to use to create the parser.")(fileResourceURIConverter)
- val rootNS = opt[RefQName]("root", argName = "node", descr = "the root
element of the XML file to use. An optional namespace may be provided. This
needs to be one of the top-level elements of the DFDL schema defined with
--schema. Requires --schema. If not supplied uses the first element of the
first schema")
- val path = opt[String](argName = "path", descr = "path to the node to
create parser.")
- val parser = opt[File](short = 'P', argName = "file", descr = "use a
previously saved parser.")
- val output = opt[String](argName = "file", descr = "write output to a
given file. If not given or is -, output is written to stdout.")
- val validate: ScallopOption[ValidationMode.Type] =
opt[ValidationMode.Type](short = 'V', default = Some(ValidationMode.Off),
argName = "mode", descr = "the validation mode. 'on', 'limited', 'off', or a
validator plugin name.")
- val vars = props[String]('D', keyName = "variable", valueName = "value",
descr = "variables to be used when parsing. An optional namespace may be
provided.")
- val tunables = props[String]('T', keyName = "tunable", valueName =
"value", descr = "daffodil tunable to be used when parsing.")
- val config = opt[File](short = 'c', argName = "file", descr = "path to
file containing configuration items.")
- val infosetType = opt[InfosetType.Type](short = 'I', argName =
"infoset_type", descr = "infoset type to output. Must be one of 'xml',
'scala-xml', 'json', 'jdom', 'w3cdom', 'sax', or 'null'.", default =
Some(InfosetType.XML))
- val stream = toggle(noshort = true, default = Some(false), descrYes =
"when left over data exists, parse again with remaining data, separating
infosets by a NUL character", descrNo = "stop after the first parse, even if
left over data exists")
- val infile = trailArg[String](required = false, descr = "input file to
parse. If not specified, or a value of -, reads from stdin.")
+ val config = opt[File](short = 'c', argName = "file", descr = "Path to XML
file containing configuration items")
+ val vars = props[String]('D', keyName = "variable", valueName = "value",
descr = "Variables to be used when parsing. An optional namespace may be
provided.")
Review comment:
Personally, I'd rather sort these vals by the val name rather than the
short value. At first it looked like this was out of order.
Also, maybe we should change this to `short = 'D'` to be consistent with
other options with custom short letters?
##########
File path: daffodil-cli/src/main/scala/org/apache/daffodil/Main.scala
##########
@@ -458,53 +413,94 @@ class CLIConf(arguments: Array[String]) extends
scallop.ScallopConf(arguments)
}
}
- // Save Subcommand Options
+ // Save Parser Subcommand Options
object save extends scallop.Subcommand("save-parser") {
- banner("""|Usage: daffodil save-parser -s <schema> [-r [{namespace}]<root>]
- | [-p <path>]
- |
[-D[{namespace}]<variable>=<value>...]
- | [-c <file>] [outfile]
+ banner("""|Usage: daffodil save-parser -s <schema> [-r
[{<namespace>}]<root>] [-p <path>]
+ |
[-D[{<namespace>}]<variable>=<value>...] [-c <file>]
+ | [outfile]
|
|Create and save a parser using a DFDL schema
|
|Save Parser Options:""".stripMargin)
- descr("save a daffodil parser for reuse")
+ descr("Save a Daffodil parser for reuse")
helpWidth(76)
- val schema = opt[URI]("schema", argName = "file", required = true, descr =
"the annotated DFDL schema to use to create the
parser.")(fileResourceURIConverter)
- val rootNS = opt[RefQName]("root", argName = "node", descr = "the root
element of the XML file to use. An optional namespace may be provided. This
needs to be one of the top-level elements of the DFDL schema defined with
--schema. Requires --schema. If not supplied uses the first element of the
first schema")
- val path = opt[String](argName = "path", descr = "path to the node to
create parser.")
- val outfile = trailArg[String](required = false, descr = "output file to
save parser. If not specified, or a value of -, writes to stdout.")
- val vars = props[String]('D', keyName = "variable", valueName = "value",
descr = "variables to be used.")
- val tunables = props[String]('T', keyName = "tunable", valueName =
"value", descr = "daffodil tunable to be used when parsing.")
- val config = opt[File](short = 'c', argName = "file", descr = "path to
file containing configuration items.")
+ val config = opt[File](short = 'c', argName = "file", descr = "Path to XML
file containing configuration items")
+ val vars = props[String]('D', keyName = "variable", valueName = "value",
descr = "Variables to be used when parsing. An optional namespace may be
provided.")
+ val path = opt[String](argName = "path", descr = "Path from root element
to node from which to start parsing")
+ val rootNS = opt[RefQName]("root", argName = "node", descr = "The root
element to use. An optional namespace may be provided. This must be one of the
top-level elements of the DFDL schema defined with --schema. Requires --schema.
If not supplied, uses schema's first top-level element.")
+ val schema = opt[URI]("schema", argName = "file", required = true, descr =
"The annotated DFDL schema to use to create the
parser")(fileResourceURIConverter)
+ val tunables = props[String]('T', keyName = "tunable", valueName =
"value", descr = "Tunable configuration options to change Daffodil's behavior")
+
+ val outfile = trailArg[String](required = false, descr = "Output file to
save parser to. If not specified, or a value of -, saves to stdout.")
requireOne(schema) // --schema must be provided
validateFileIsFile(config) // --config must be a file that exists
}
// Test Subcommand Options
object test extends scallop.Subcommand("test") {
- banner("""|Usage: daffodil test <tdmlfile> [testname...]
+ banner("""|Usage: daffodil test [-l] [-r] [-i] <tdmlfile> [testname...]
|
|List or execute tests in a TDML file
|
|Test Options:""".stripMargin)
- descr("list or execute TDML tests")
+ descr("List or execute TDML tests")
helpWidth(76)
- val list = opt[Boolean](descr = "show names and descriptions instead of
running test cases.")
- val regex = opt[Boolean](descr = "treat <names> as regular expressions.")
- val tdmlfile = trailArg[String](required = true, descr = "test data markup
language (TDML) file.")
- val names = trailArg[List[String]](required = false, descr = "name of test
case(s) in tdml file. If not given, all tests in tdmlfile are run.")
- val info = tally(descr = "increment test result information output level,
one level for each -i")
+ val info = tally(descr = "Increment test result information output level,
one level for each -i")
+ val list = opt[Boolean](descr = "Show names and descriptions instead of
running test cases")
+ val regex = opt[Boolean](descr = "Treat <testname...> as regular
expressions")
+ val tdmlfile = trailArg[String](required = true, descr = "Test Data Markup
Language (TDML) file")
+ val names = trailArg[List[String]](required = false, descr = "Name(s) of
test cases in tdmlfile. If not given, all tests in tdmlfile are run.")
+ }
+
+ // Performance Subcommand Options
+ object performance extends scallop.Subcommand("performance") {
+ banner("""|Usage: daffodil performance (-s <schema> [-r
[{<namespace>}]<root>] [-p <path>] |
+ | -P <parser>)
+ |
[-D[{<namespace>}]<variable>=<value>...]
+ | [-u] [-V [mode]] [-N <number>] [-t
<threads>]
+ | [-I <infoset_type>] [-c <file>]
+ | <infile>
+ |
+ |Run a performance test, using either a DFDL schema or a saved
parser
+ |
+ |Performance Options:""".stripMargin)
+
+ descr("Run performance test")
+ helpWidth(76)
+
+ val config = opt[File](short = 'c', argName = "file", descr = "Path to XML
file containing configuration items")
+ val vars = props[String]('D', keyName = "variable", valueName = "value",
descr = "Variables to be used when parsing or unparsing. An optional namespace
may be provided.")
+ val infosetType = opt[InfosetType.Type](short = 'I', argName =
"infoset_type", descr = "Infoset type to output or unparse. Must be one of
'xml', 'scala-xml', 'json', 'jdom', 'w3cdom', 'sax', or 'null'.", default =
Some(InfosetType.XML))
+ val number = opt[Int](short = 'N', argName = "number", default = Some(1),
descr = "The total number of files to process. Defaults to 1.")
Review comment:
I just noticed that sometimes we include a "Defaults to .." message, but
sometimes we don't. For example, infoseType defaults to "xml". Should we be
consistent, and any option that has a default value, we should mention what it
defaults to in the help string?
##########
File path: daffodil-cli/src/main/scala/org/apache/daffodil/Main.scala
##########
@@ -370,78 +369,34 @@ class CLIConf(arguments: Array[String]) extends
scallop.ScallopConf(arguments)
}
- // Performance Subcommand Options
- object performance extends scallop.Subcommand("performance") {
- banner("""|Usage: daffodil performance (-s <schema> [-r
[{namespace}]<root>] [-p <path>] |
- | -P <parser>)
- | [--unparse]
- | [--validate [mode]]
- | [-N <number of files to process>]
- | [-t <threadcount>]
- | [-D[{namespace}]<variable>=<value>...]
- | [-I <infoset_type>]
- | [-c <file>] <infile>
- |
- |Run a performance test (parse or unparse), using either a DFDL
schema or a saved parser
- |
- |Performance Options:""".stripMargin)
-
- descr("run performance test")
- helpWidth(76)
-
- val schema = opt[URI]("schema", argName = "file", descr = "the annotated
DFDL schema to use to create the parser.")(fileResourceURIConverter)
- val unparse = opt[Boolean](default = Some(false), descr = "perform unparse
instead of parse for performance.")
- val rootNS = opt[RefQName]("root", argName = "node", descr = "the root
element of the XML file to use. An optional namespace may be provided. This
needs to be one of the top-level elements of the DFDL schema defined with
--schema. Requires --schema. If not supplied uses the first element of the
schema")
- val number = opt[Int](short = 'N', argName = "number", default = Some(1),
descr = "The total number of files to process.")
- val threads = opt[Int](short = 't', argName = "threads", default =
Some(1), descr = "The number of threads to use.")
- val path = opt[String](argName = "path", descr = "path to the node to
create parser.")
- val parser = opt[File](short = 'P', argName = "file", descr = "use a
previously saved parser.")
- val validate: ScallopOption[ValidationMode.Type] =
opt[ValidationMode.Type](short = 'V', default = Some(ValidationMode.Off),
argName = "mode", descr = "the validation mode. 'on', 'limited', 'off', or a
validator plugin name.")
- val vars = props[String]('D', keyName = "variable", valueName = "value",
descr = "variables to be used when processing. An optional namespace may be
provided.")
- val tunables = props[String]('T', keyName = "tunable", valueName =
"value", descr = "daffodil tunable to be used when processing.")
- val config = opt[File](short = 'c', argName = "file", descr = "path to
file containing configuration items.")
- val infosetType = opt[InfosetType.Type](short = 'I', argName =
"infoset_type", descr = "infoset type to parse/unparse. Must be one of 'xml',
'scala-xml', 'json', 'jdom', 'w3cdom', 'sax', or 'null'.", default =
Some(InfosetType.XML))
- val infile = trailArg[String](required = true, descr = "input file or
directory containing files to process.")
-
- requireOne(schema, parser) // must have one of --schema or --parser
- conflicts(parser, List(rootNS)) // if --parser is provided, cannot also
provide --root
- validateFileIsFile(config) // --config must be a file that exists
-
- validateOpt(infosetType, unparse) {
- case (Some(InfosetType.NULL), Some(true)) => Left("null infoset type not
valid with performance --unparse")
- case _ => Right(Unit)
- }
- }
-
// Unparse Subcommand Options
object unparse extends scallop.Subcommand("unparse") {
- banner("""|Usage: daffodil unparse (-s <schema> [-r [{namespace}]<root>]
[-p <path>] |
+ banner("""|Usage: daffodil unparse (-s <schema> [-r [{<namespace>}]<root>]
[-p <path>] |
| -P <parser>)
- | [--validate [mode]]
- | [-D[{namespace}]<variable>=<value>...]
[-c <file>]
- | [-I <infoset_type>]
- | [--stream]
- | [-o <output>] [infile]
+ |
[-D[{<namespace>}]<variable>=<value>...] [-o <output>]
+ | [-V [mode]] [--stream] [-I
<infoset_type>] [-c <file>]
+ | [infile]
|
|Unparse an infoset file, using either a DFDL schema or a saved
parser
|
|Unparse Options:""".stripMargin)
- descr("unparse a DFDL infoset")
+ descr("Unparse a DFDL infoset")
helpWidth(76)
- val schema = opt[URI]("schema", argName = "file", descr = "the annotated
DFDL schema to use to create the parser.")(fileResourceURIConverter)
- val rootNS = opt[RefQName]("root", argName = "node", descr = "the root
element of the XML file to use. An optional namespace may be provided. This
needs to be one of the top-level elements of the DFDL schema defined with
--schema. Requires --schema. If not supplied uses the first element of the
schema")
- val path = opt[String](argName = "path", descr = "path to the node to
create parser.")
- val parser = opt[File](short = 'P', argName = "file", descr = "use a
previously saved parser.")
- val output = opt[String](argName = "file", descr = "write output to file.
If not given or is -, output is written to standard output.")
- val validate: ScallopOption[ValidationMode.Type] =
opt[ValidationMode.Type](short = 'V', default = Some(ValidationMode.Off),
argName = "mode", descr = "the validation mode. 'on', 'limited', 'off', or a
validator plugin name.")
- val vars = props[String]('D', keyName = "variable", valueName = "value",
descr = "variables to be used when unparsing. An optional namespace may be
provided.")
- val tunables = props[String]('T', keyName = "tunable", valueName =
"value", descr = "daffodil tunable to be used when parsing.")
- val config = opt[File](short = 'c', argName = "file", descr = "path to
file containing configuration items.")
- val infosetType = opt[InfosetType.Type](short = 'I', argName =
"infoset_type", descr = "infoset type to unparse. Must be one of 'xml',
'scala-xml', 'json', 'jdom', 'w3cdom' or 'sax'.", default =
Some(InfosetType.XML))
- val stream = toggle(noshort = true, default = Some(false), descrYes =
"split the input data on the NUL character, and unparse each chuck separately",
descrNo = "treat the entire input data as one infoset")
- val infile = trailArg[String](required = false, descr = "input file to
unparse. If not specified, or a value of -, reads from stdin.")
+ val config = opt[File](short = 'c', argName = "file", descr = "Path to XML
file containing configuration items")
+ val vars = props[String]('D', keyName = "variable", valueName = "value",
descr = "Variables to be used when unparsing. An optional namespace may be
provided.")
+ val infosetType = opt[InfosetType.Type](short = 'I', argName =
"infoset_type", descr = "Infoset type to unparse. Use 'xml', 'scala-xml',
'json', 'jdom', 'w3cdom', or 'sax'.", default = Some(InfosetType.XML))
+ val output = opt[String](argName = "file", descr = "Output file to write
unparsed infoset to. If not given or is -, unparsed infoset is written to
stdout.")
Review comment:
At first I read this it's writing the infoset, and thought something was
wrong. I guess the "unparsed infoset" implies that it is writing the the data
that is created from unparsing the infoset, and so is technically right, but it
stil feels a bit confusing to me. Especially since there is a concept of an
"augmented infoset" that is created during unparsing. It's possible someone
might interpret this as writing that infoset. I do understand how saying
"unparsed data" could also be confusing though. Maybe we just say "Output file
to write data to", with the imlication that the data is the data from unparsing
the infoset? Maybe I'm overthinking this...
##########
File path: daffodil-cli/src/main/scala/org/apache/daffodil/Main.scala
##########
@@ -319,40 +319,39 @@ class CLIConf(arguments: Array[String]) extends
scallop.ScallopConf(arguments)
shortSubcommandsHelp()
// Global Options
- val debug = opt[Option[String]](argName = "file", descr = "enable debugging.
Optionally, read initial debugger commands from [file] if
provided.")(optionalValueConverter[String](a => a))
- val trace = opt[Boolean](descr = "run the debugger with verbose trace
output")
- val verbose = tally(descr = "increment verbosity level, one level for each
-v")
- val version = opt[Boolean](descr = "Show version of this program")
+ val debug = opt[Option[String]](argName = "file", descr = "Enable the
interactive debugger. Optionally, read initial debugger commands from [file] if
provided.")(optionalValueConverter[String](a => a))
+ val trace = opt[Boolean](descr = "Run this program with verbose trace
output")
+ val verbose = tally(descr = "Increment verbosity level, one level for each
-v")
+ val version = opt[Boolean](descr = "Show Daffodil's version")
// Parse Subcommand Options
object parse extends scallop.Subcommand("parse") {
- banner("""|Usage: daffodil parse (-s <schema> [-r [{namespace}]<root>] [-p
<path>] |
+ banner("""|Usage: daffodil parse (-s <schema> [-r [{<namespace>}]<root>]
[-p <path>] |
| -P <parser>)
- | [--validate [mode]]
- | [-D[{namespace}]<variable>=<value>...]
[-o <output>]
- | [-I <infoset_type>]
- | [--stream]
- | [-c <file>] [infile]
+ | [-D[{<namespace>}]<variable>=<value>...]
[-o <output>]
+ | [-V [mode]] [--stream] [-I
<infoset_type>] [-c <file>]
+ | [infile]
|
|Parse a file, using either a DFDL schema or a saved parser
|
|Parse Options:""".stripMargin)
- descr("parse data to a DFDL infoset")
+ descr("Parse data to a DFDL infoset")
helpWidth(76)
- val schema = opt[URI]("schema", argName = "file", descr = "the annotated
DFDL schema to use to create the parser.")(fileResourceURIConverter)
- val rootNS = opt[RefQName]("root", argName = "node", descr = "the root
element of the XML file to use. An optional namespace may be provided. This
needs to be one of the top-level elements of the DFDL schema defined with
--schema. Requires --schema. If not supplied uses the first element of the
first schema")
- val path = opt[String](argName = "path", descr = "path to the node to
create parser.")
- val parser = opt[File](short = 'P', argName = "file", descr = "use a
previously saved parser.")
- val output = opt[String](argName = "file", descr = "write output to a
given file. If not given or is -, output is written to stdout.")
- val validate: ScallopOption[ValidationMode.Type] =
opt[ValidationMode.Type](short = 'V', default = Some(ValidationMode.Off),
argName = "mode", descr = "the validation mode. 'on', 'limited', 'off', or a
validator plugin name.")
- val vars = props[String]('D', keyName = "variable", valueName = "value",
descr = "variables to be used when parsing. An optional namespace may be
provided.")
- val tunables = props[String]('T', keyName = "tunable", valueName =
"value", descr = "daffodil tunable to be used when parsing.")
- val config = opt[File](short = 'c', argName = "file", descr = "path to
file containing configuration items.")
- val infosetType = opt[InfosetType.Type](short = 'I', argName =
"infoset_type", descr = "infoset type to output. Must be one of 'xml',
'scala-xml', 'json', 'jdom', 'w3cdom', 'sax', or 'null'.", default =
Some(InfosetType.XML))
- val stream = toggle(noshort = true, default = Some(false), descrYes =
"when left over data exists, parse again with remaining data, separating
infosets by a NUL character", descrNo = "stop after the first parse, even if
left over data exists")
- val infile = trailArg[String](required = false, descr = "input file to
parse. If not specified, or a value of -, reads from stdin.")
+ val config = opt[File](short = 'c', argName = "file", descr = "Path to XML
file containing configuration items")
+ val vars = props[String]('D', keyName = "variable", valueName = "value",
descr = "Variables to be used when parsing. An optional namespace may be
provided.")
+ val infosetType = opt[InfosetType.Type](short = 'I', argName =
"infoset_type", descr = "Infoset type to output. Use 'xml', 'scala-xml',
'json', 'jdom', 'w3cdom', 'sax', or 'null'.", default = Some(InfosetType.XML))
+ val output = opt[String](argName = "file", descr = "Output file to write
infoset to. If not given or is -, infoset is written to stdout.")
+ val parser = opt[File](short = 'P', argName = "file", descr = "Use a
previously saved parser")
+ val path = opt[String](argName = "path", descr = "Path from root element
to node from which to start parsing")
Review comment:
I wonder if we should hide this path option by adding `hidden = true`?
Daffodil only supports `/`, so cluttering the help output with this option that
isn't really an option probably doesn't add anything and just makes the help
output more verbose. And by hiding it, people can still use it so it won't
break backwards compatibility.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]