Skip to content

Commit a8f4c03

Browse files
Add better option descriptions (#72)
* Add better option descriptions * Small fix in RdfInspect * Small fix in RdfInspect * Update src/main/scala/eu/neverblink/jelly/cli/command/Version.scala Co-authored-by: Piotr Sowiński <ostrzycielnozyczek@gmail.com> --------- Co-authored-by: Karolina Bogacka <karolina@neverblink.eu> Co-authored-by: Piotr Sowiński <ostrzycielnozyczek@gmail.com>
1 parent cd99938 commit a8f4c03

File tree

5 files changed

+55
-8
lines changed

5 files changed

+55
-8
lines changed

src/main/scala/eu/neverblink/jelly/cli/JellyCommand.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import java.io.*
77
import scala.compiletime.uninitialized
88

99
case class JellyCommandOptions(
10-
@HelpMessage("Add to run command in debug mode") debug: Boolean = false,
11-
@HelpMessage("Add to silence any warnings") quiet: Boolean = false,
10+
@HelpMessage("Add to run command in debug mode. ") debug: Boolean = false,
11+
@HelpMessage("Add to silence any warnings. ") quiet: Boolean = false,
1212
)
1313

1414
trait HasJellyCommandOptions:

src/main/scala/eu/neverblink/jelly/cli/command/Version.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ package eu.neverblink.jelly.cli.command
33
import caseapp.*
44
import eu.neverblink.jelly.cli.*
55

6+
@HelpMessage(
7+
"Prints the version of the jelly-cli utility and the Jelly-JVM library.",
8+
)
69
case class VersionOptions(
710
@Recurse
811
common: JellyCommandOptions = JellyCommandOptions(),

src/main/scala/eu/neverblink/jelly/cli/command/rdf/RdfFromJelly.scala

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,25 @@ import java.io.{InputStream, OutputStream}
1515
object RdfFromJellyPrint extends RdfCommandPrintUtil[RdfFormat.Writeable]:
1616
override val defaultFormat: RdfFormat = RdfFormat.NQuads
1717

18+
@HelpMessage(
19+
"Translates a Jelly-RDF stream to a different RDF format. \n" +
20+
"If no input file is specified, the input is read from stdin.\n" +
21+
"If no output file is specified, the output is written to stdout.\n" +
22+
"If an error is detected, the program will exit with a non-zero code.\n" +
23+
"Otherwise, the program will exit with code 0.\n" +
24+
"Note: this command works in a streaming manner and scales well to large files",
25+
)
26+
@ArgsName("<file-to-convert>")
1827
case class RdfFromJellyOptions(
1928
@Recurse
2029
common: JellyCommandOptions = JellyCommandOptions(),
30+
@HelpMessage(
31+
"Output file to write the RDF to. If not specified, the output is written to stdout.",
32+
)
2133
@ExtraName("to") outputFile: Option[String] = None,
22-
@ValueDescription("Output format.")
2334
@HelpMessage(
24-
RdfFromJellyPrint.helpMsg,
35+
"RDF format Jelly should be translated to. " +
36+
"If not explicitly specified, but output file supplied, the format is inferred from the file name. " + RdfFromJellyPrint.helpMsg,
2537
)
2638
@ExtraName("out-format") outputFormat: Option[String] = None,
2739
) extends HasJellyCommandOptions

src/main/scala/eu/neverblink/jelly/cli/command/rdf/RdfInspect.scala

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,36 @@
11
package eu.neverblink.jelly.cli.command.rdf
22

3-
import caseapp.{ExtraName, Recurse}
3+
import caseapp.{ArgsName, ExtraName, HelpMessage, Recurse}
44
import caseapp.core.RemainingArgs
55
import eu.neverblink.jelly.cli.*
66
import eu.neverblink.jelly.cli.command.rdf.util.{FrameInfo, JellyUtil, MetricsPrinter}
77
import eu.ostrzyciel.jelly.core.proto.v1.*
88

99
import java.io.InputStream
10-
10+
@HelpMessage(
11+
"Prints statistics about a Jelly-RDF stream.\n" +
12+
"Statistics include: Jelly stream options and counts of various row types, " +
13+
"including triples, quads, names, prefixes, " +
14+
"namespaces, datatypes, and graphs.\n" +
15+
"Output statistics are returned as a valid YAML. \n" +
16+
"If no input file is specified, the input is read from stdin.\n" +
17+
"If no output file is specified, the output is written to stdout.\n" +
18+
"If an error is detected, the program will exit with a non-zero code.\n" +
19+
"Otherwise, the program will exit with code 0.\n",
20+
"Note: this command works in a streaming manner and scales well to large files",
21+
)
22+
@ArgsName("<file-to-inspect>")
1123
case class RdfInspectOptions(
1224
@Recurse
1325
common: JellyCommandOptions = JellyCommandOptions(),
26+
@HelpMessage(
27+
"File to write the output statistics to. If not specified, the output is written to stdout.",
28+
)
1429
@ExtraName("to") outputFile: Option[String] = None,
30+
@HelpMessage(
31+
"Whether to print the statistics per frame (default: false). " +
32+
"If true, the statistics are computed and printed separately for each frame in the stream.",
33+
)
1534
@ExtraName("per-frame") perFrame: Boolean = false,
1635
) extends HasJellyCommandOptions
1736

src/main/scala/eu/neverblink/jelly/cli/command/rdf/RdfToJelly.scala

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,26 @@ import scala.util.Using
1515
object RdfToJellyPrint extends RdfCommandPrintUtil[RdfFormat.Readable]:
1616
override val defaultFormat: RdfFormat = RdfFormat.NQuads
1717

18+
@HelpMessage(
19+
"Translates an RDF file to a Jelly-RDF stream. \n" +
20+
"If no input file is specified, the input is read from stdin.\n" +
21+
"If no output file is specified, the output is written to stdout.\n" +
22+
"If an error is detected, the program will exit with a non-zero code.\n" +
23+
"Otherwise, the program will exit with code 0.\n" +
24+
"Note: this command works in a streaming manner and scales well to large files. ",
25+
)
26+
@ArgsName("<file-to-convert>")
1827
case class RdfToJellyOptions(
1928
@Recurse
2029
common: JellyCommandOptions = JellyCommandOptions(),
30+
@HelpMessage(
31+
"Output file to write the Jelly to. If not specified, the output is written to stdout.",
32+
)
2133
@ExtraName("to") outputFile: Option[String] = None,
22-
@ValueDescription("Input format.")
2334
@HelpMessage(
24-
RdfToJellyPrint.helpMsg,
35+
"RDF format of the data that should be translated to Jelly. " +
36+
"If not explicitly specified, but input file supplied, the format is inferred from the file name. " +
37+
RdfToJellyPrint.helpMsg,
2538
)
2639
@ExtraName("in-format") inputFormat: Option[String] = None,
2740
@Recurse

0 commit comments

Comments
 (0)