Skip to content

Commit

Permalink
Add verbosity to pgp key-id command (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexarchambault authored May 20, 2022
1 parent cc82a9d commit 7599118
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 9 additions & 2 deletions cli-options/src/scala/cli/signing/commands/PgpKeyIdOptions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@ package scala.cli.signing.commands

import caseapp._

// format: off
final case class PgpKeyIdOptions(
fingerprint: Boolean = false
)
fingerprint: Boolean = false,
@ExtraName("v")
verbose: Int @@ Counter = Tag.of(0)
) {
// format: on

lazy val verbosity = Tag.unwrap(verbose)
}

object PgpKeyIdOptions {
implicit lazy val parser: Parser[PgpKeyIdOptions] = Parser.derive
Expand Down
6 changes: 5 additions & 1 deletion cli/src/scala/cli/signing/commands/PgpKeyId.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,13 @@ object PgpKeyId extends Command[PgpKeyIdOptions] {

def run(options: PgpKeyIdOptions, args: RemainingArgs): Unit =
for (arg <- args.all) {
val path = os.Path(arg, os.pwd)
val path = os.Path(arg, os.pwd)
if (options.verbosity >= 2)
System.err.println(s"Reading $path")
val keyContent = os.read.bytes(path)
val values = get(keyContent, options.fingerprint)
if (options.verbosity >= 2)
System.err.println(s"Values: $values")
for (value <- values)
println(value)
}
Expand Down

0 comments on commit 7599118

Please sign in to comment.