Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow option flags to accept False value #8788

Closed
ojob opened this issue Apr 18, 2023 · 6 comments · Fixed by #8879
Closed

Allow option flags to accept False value #8788

ojob opened this issue Apr 18, 2023 · 6 comments · Fixed by #8879
Labels

Comments

@ojob
Copy link

ojob commented Apr 18, 2023

Context

I have a project where pandoc is used to generate a Reveal.JS presentation, and this project aims to be a presentation generator.

In order to allow for offline usage and proper archival, I use the --embed-resources --standalone option flags, and I want this to be the default behavior so I set them in the defaults parameters file.

Observed Problem

During writing, it is much faster not to embedd the resources. But my defaults file activates the --embed-resources, and there is no way to overload the flag for deactivation. Providing --embed-resources=false is refused.

For the moment, I therefore deactivated the embed-resources in the defaults file, but shall take care to activate it in the rendering pipeline.

Proposal

Allow for overloading the embed-resources option from defaults with a command-line value requesting no embedding.

In #8362, in particular with one answer, there is a proposal to extend accepted values for --embed-resources flag with none value: this would be perfect.

@tarleb tarleb added good first issue CLI Command Line Interface labels May 4, 2023
@tarleb
Copy link
Collaborator

tarleb commented May 4, 2023

This would require small changes in file src/Text/Pandoc/App/CommandLineOptions.hs, changing NoArg to OptArg for the relevant options.

@ojob
Copy link
Author

ojob commented May 6, 2023

Thanks for the analysis!

I could see to propose a PR, but I'm not at ease with Haskell; do I need to set up a Haskell environment for this update? Or is a simple file update, and the CI will do its job properly?

@tarleb
Copy link
Collaborator

tarleb commented May 6, 2023

I'd suggest to setup a local Haskell env to enable proper testing. It might be possible to do this only with the CI, but I'd expect it to be a slightly frustrating experience.

ghcup is probably the easiest method to get a Haskell environment up and running. I feel obliged to point out that it is a non-negligible time investment to get started. Compiling pandoc and all of its dependencies from scratch takes ~30 min (less on newer hardware). I think it has become a bit of a meme in Haskell circles.

@samahri
Copy link
Contributor

samahri commented May 30, 2023

Hello everyone,
I'm a huge fan of pandoc and appreciate all the great work you do here.

I've taken the initiative to create a pull request that addresses OP's request. Please feel free to take a look at it.

@jgm jgm closed this as completed in #8879 Jun 28, 2023
jgm pushed a commit that referenced this issue Jun 28, 2023
Default is true if no value is specified, so this is fully backwards-compatible.

Closes #8788.
@ojob
Copy link
Author

ojob commented Jul 3, 2023

Hi @samahri thanks for the implementation!! My Haskell level would have been really too low to achieve your improvements.

Now I'm looking forward to the release to production :)

@samahri
Copy link
Contributor

samahri commented Jul 3, 2023

Glad I could help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants