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

Adds support for options to CLI and improves usability #586

Merged
merged 9 commits into from
Feb 14, 2023

Conversation

DaRosenberg
Copy link
Contributor

@DaRosenberg DaRosenberg commented Feb 8, 2023

This PR adds the following improvements to the CLI experience:

  • CLI now exposes options for most of the LiquidOptions properties
  • Template can now be passed using --template option (inline or as path)
  • Context can now be passed either using --context option (inline or as path) or piped through stdin
  • Output can be written to a file using --output option (default is to write to stdout like before)
  • Legacy mode is retained in which template is piped through stdin to retain compat; should be removed for 11.0
  • CLI now validates and prints argument errors
  • CLI now supports a --help argument to print usage information
  • Docs and setup tutorial are updated accordingly

The --template option is necessary to distinguish legacy mode, but can be removed in favor of a nameless argument for version 11.0, so the syntax would become for example:

npx liquidjs 'Hello, {{ name }}!' --context '{"name": "Snake"}' --js-truthy

Fixes #583
Fixes #584
Fixes #585

@DaRosenberg
Copy link
Contributor Author

@harttle Any idea when you might get a chance to either merge this one, or let me know if further changes are required?

Reason I ask is, we need this functionality, and if it will take several weeks to get it into a release, then I think we may need to think about publishing our own wrapper package for this instead.

Copy link
Owner

@harttle harttle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I thought I had submited review but actually not. It won't take weeks, I can follow this PR every day or two.

bin/liquid.js Outdated Show resolved Hide resolved
bin/liquid.js Outdated Show resolved Hide resolved
bin/liquid.js Outdated Show resolved Hide resolved
bin/liquid.js Outdated Show resolved Hide resolved
bin/liquid.js Outdated Show resolved Hide resolved
@DaRosenberg DaRosenberg requested a review from harttle February 13, 2023 17:51
@harttle harttle merged commit 24c8a1e into harttle:master Feb 14, 2023
github-actions bot pushed a commit that referenced this pull request Feb 14, 2023
# [10.5.0](v10.4.0...v10.5.0) (2023-02-14)

### Bug Fixes

* "ownPropertyOnly" not respected when passed via "renderOptions" ([d489916](d489916))

### Features

* Adds support for options to CLI and improves usability ([#586](#586)) ([24c8a1e](24c8a1e))
@github-actions
Copy link

🎉 This PR is included in version 10.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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