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

CLI Improvements #356

Merged
merged 3 commits into from
Dec 23, 2019
Merged

CLI Improvements #356

merged 3 commits into from
Dec 23, 2019

Conversation

antfu
Copy link
Member

@antfu antfu commented Dec 23, 2019

This PR rewrites CLI using commander.js

CLI Options

 ,_ ,_
 \/ ==
 /\ []

WENYAN LANG 文言 Compiler v0.0.2

Usage: wenyan [options] [files...]

Options:
  -v, --version        Output the version
  -l, --lang <lang>    Target language, can be "js", "py" or "rb" (default: "js")
  -c, --compile        Output the compiled code instead of executing it
  -e, --eval <code>    Evaluate script
  -i, --interactive    Interactive REPL
  -o, --output [file]  Output compiled code or executing result to file
  -r, --render         Outputs renderings
  --roman              Romanize identifiers
  --log <file>         Save log to file
  --title <title>      Override title in rendering
  -h, --help           Display help

Changes

  • Default to executing mode instead of compiling, refer to CLI improvements #353
  • Make "flag" options not requiring values. (previous --exec=somehing makes no sense, all its need is --exec)
  • --help option added
  • The value of --output is optional
wenyan helloworld.wy --compile
# Output to console

wenyan helloworld.wy --compile --output
# Output to helloworld.js (same name as the input)

wenyan helloworld.wy --compile --output a.js
# Output to a.js
  • Separate --render and --title. IMO, --render=圖靈機 is not very intuitive. Now please use
wenyan turing.wy --render --title=圖靈機

wenyan turing.wy --render
# the title will be the filename "turing"
  • Make -r shorthand for --render instead of --roman

@LingDong- LingDong- merged commit 9d80e2c into wenyan-lang:master Dec 23, 2019
@LingDong-
Copy link
Member

Looks great, thanks!

LingDong- added a commit that referenced this pull request Jan 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants