ggrossetie / asciidoctor-web-pdf

Convert AsciiDoc documents to PDF using web technologies
https://asciidoctor.org
MIT License
448 stars 92 forks source link

errors running `asciidoctorjs-pdf -v` on Win10 WSL node v10.15.0 #54

Closed abelsromero closed 5 years ago

abelsromero commented 5 years ago

After installing asciidoctor in a npm project with the following dependencies

  "dependencies": {
    "asciidoctor": "^2.0.3",
    "asciidoctor-pdf": "^1.0.0-alpha.1",
    "gulp-cli": "^2.2.0"
  },

I get the following error

require undefined
template-require undefined
backend undefined
doctype article
header-footer true
section-numbers false
quiet false
verbose true
timings false
trace false
base-dir undefined
destination-dir undefined
verbose-mode 2
attributes
options {"doctype":"article","safe":"unsafe","header_footer":true,"verbose":2,"timings":false,"trace":false,"to_file":false,"attributes":[]}
asciidoctorjs-pdf [files...]

Options:
  --help                  Show help                                                                            [boolean]
  --doctype, -d           document type to use when converting document
                                                  [choices: "article", "book", "manpage", "inline"] [default: "article"]
  --template-require      require the specified template script                                                 [string]
  --out-file, -o          output file (default: based on path of input file) use '' to output to STDOUT         [string]
  --safe-mode, -S         set safe mode level explicitly, disables potentially dangerous macros in source files, such as
                          include::[]                [choices: "unsafe", "safe", "server", "secure"] [default: "unsafe"]
  --no-header-footer, -s  suppress output of header and footer                                [boolean] [default: false]
  --section-numbers, -n   auto-number section titles in the HTML backend disabled by default  [boolean] [default: false]
  --base-dir, -B          base directory containing the document and resources (default: directory of source file)
                                                                                                                [string]
  --destination-dir, -D   destination output directory (default: directory of source file)                      [string]
  --quiet, -q             suppress warnings                                                   [boolean] [default: false]
  --trace                 include backtrace information on errors                             [boolean] [default: false]
  --verbose, -v           enable verbose mode                                                 [boolean] [default: false]
  --timings, -t           enable timings mode                                                 [boolean] [default: false]
  --attribute, -a         a document attribute to set in the form of key, key! or key=value pair                 [array]
  --require, -r           require the specified library before executing the processor, using the standard Node require
                                                                                                                 [array]
  --watch, -w             enable watch mode                                                   [boolean] [default: false]
  --version, -V           display the version and runtime environment (or -v if no other flags or arguments)
                                                                                              [boolean] [default: false]

when running node_modules/asciidoctor-pdf/bin/asciidoctorjs-pdf -v.

Using --version works fine šŸ‘

ggrossetie commented 5 years ago

It's not really an error, it's the "verbose" mode and since you didn't provide any other arguments the command is "invalid" so in this case we display the usage/help.

If you want to display the version, you need to use the uppercase -V

So either:

$ node_modules/asciidoctor-pdf/bin/asciidoctorjs-pdf -V

or:

$ node_modules/asciidoctor-pdf/bin/asciidoctorjs-pdf --version
abelsromero commented 5 years ago

I got it, but nevertheless is confusing:

All return the version, even when the prompt says to use capital V.

ggrossetie commented 5 years ago

I see... it looks like I did it for the Asciidoctor.js CLI but this "feature" is not available here: https://github.com/asciidoctor/asciidoctor-cli.js/issues/57

I might have missed something... šŸ¤”

ggrossetie commented 5 years ago

Actually I think it's already fixed on master: https://github.com/Mogztter/asciidoctor-pdf.js/blob/3ee47079489ec6b787386759786a48128d4485a7/lib/cli.js#L46-L51

I will release another alpha, stay tuned šŸ˜‰

ggrossetie commented 5 years ago

The new version is out:

$ asciidoctor-pdf -v
Asciidoctor PDF 1.0.0-alpha.2 using Asciidoctor.js 2.0.0 (Asciidoctor 2.0.6) [https://asciidoctor.org]
Runtime Environment (node v10.15.1 on linux)
CLI version 3.0.1
abelsromero commented 5 years ago

You are awesome!