summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2022-06-26 13:55:01 -0600
committerGitHub <noreply@github.com>2022-06-26 13:55:01 -0600
commitdd29c494e40fa6d6399c11dd4b0518bc26ab930c (patch)
tree4ab795e0f452bb886bf2b72eb8ae0b603949b54d /bin
parentb52dc8785fc03f08c190abbddc05edef7eb243bc (diff)
resolves #2250 add --theme CLI option as shorthand for -a pdf-theme (PR #2251)
Diffstat (limited to 'bin')
-rwxr-xr-xbin/asciidoctor-pdf14
1 files changed, 13 insertions, 1 deletions
diff --git a/bin/asciidoctor-pdf b/bin/asciidoctor-pdf
index b1fbcbb8..cd613723 100755
--- a/bin/asciidoctor-pdf
+++ b/bin/asciidoctor-pdf
@@ -16,8 +16,20 @@ options = (Asciidoctor::Cli::Options.new backend: 'pdf', header_footer: true).ex
end
end)
+argv = ARGV
+if (theme_idx = argv.index {|it| it == '--theme' || (it.start_with? '--theme=') })
+ if (theme_arg = argv[theme_idx]).length > 7
+ argv = argv.dup
+ argv[theme_idx..theme_idx] = ['-a', %(pdf#{theme_arg.slice 1, theme_arg.length})]
+ elsif (val = argv[theme_idx + 1]) && !(val.start_with? '-')
+ argv = argv.dup
+ argv[theme_idx] = '-a'
+ argv[theme_idx + 1] = %(pdf-theme=#{val})
+ end
+end
+
# FIXME: This is a really bizarre API. Please make me simpler.
-case (result = options.parse! ARGV)
+case (result = options.parse! argv)
when Integer
exit result
else