Skip to content

Unpredictable output #490

Open
Open
@noraj

Description

@noraj

Version of Marp Tool

v1.7.2

Operating System

Windows

Environment

  • OS version: ArchLinux and Alpine 3.16
  • Node.js version: marp core v2.4.2, nodejs v16.18.0

How to reproduce

By default, I expect the output file to go into the current/working directory and not in the input directory (at the same level as the input file). I understand that this is debatable and suggestive.

$ marp --theme-set themes  --input-dir docs                                                                                                                                                                                                                                                                                   
[  INFO ] Converting 1 markdown...                                                                                                                                                                                   
[  INFO ] docs/slides.md => docs/slides.html 

So if I want to be sure to control the output path I'll use the --output option which has this exact purpose.

$ marp --theme-set themes --output index.html --input-dir docs
[  INFO ] Converting 1 markdown...
[  INFO ] docs/slides.md => index.html/slides.html

The --output should be relative to the current/working directory so I expect the file index.html to go to $PWD/index.html. At list an expected bad behavior would be it still output to $PWD/docs/index.html. But here what the help message says:

$   -o, --output                       Output file path (or directory when                                                                                                                                             
                                     input-dir is passed)               [string]

So when input-dir is provided, --output is interpreted as a directory and not a file anymore, so it outputs to index.html/slides.html. Meaning I can control the output dir but not longer the file name.

$ marp --theme-set themes --output test --input-dir docs
[  INFO ] Converting 1 markdown...
[  INFO ] docs/slides.md => test/slides.html

$ marp --theme-set themes --output test/index.html --input-dir docs
[  INFO ] Converting 1 markdown...
[  INFO ] docs/slides.md => test/index.html/slides.html

Same context as in marp-team/marp#382

Expected behavior

eg curl has 2 options:

$ curl --help all | grep '\--output'
 -o, --output <file>      Write to file instead of stdout
     --output-dir <dir>   Directory to save files in

There should definitely be an --output-file and an --output-dir option with predictable behavior and not one --output option with unpredictable behavior that change relatively to other option being used.

Actual behavior

See How to reproduce

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions