-
-
Notifications
You must be signed in to change notification settings - Fork 413
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
Docs: Update README.md and add boa_cli
's README.md
#3659
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Boa CLI | ||
|
||
Boa CLI is `Boa`'s REPL implementation to execute `JavaScript` directly from | ||
your CLI. | ||
|
||
## Installation | ||
|
||
`boa_cli` can be installed directly via `Cargo`. | ||
|
||
```shell | ||
cargo install boa_cli | ||
``` | ||
|
||
<!-- TODO (nekevss): Add a non cargo-based installation options / build out further --> | ||
|
||
## Usage | ||
|
||
<!-- TODO (nekevss): Potentially add CI driven gifs with https://github.com/charmbracelet/vhs --> | ||
<!-- NOTE (nekevss): VHS is currently bugged and non-functional on Windows. --> | ||
|
||
Once installed, your good to go! | ||
|
||
To execute some JavaScript source code, navigate to the directy of your choosing and type: | ||
|
||
```shell | ||
boa test.js | ||
``` | ||
|
||
Or if you'd like to use Boa's REPL, simply type: | ||
|
||
```shell | ||
boa | ||
``` | ||
|
||
## CLI Options | ||
|
||
```txt | ||
Usage: boa [OPTIONS] [FILE]... | ||
|
||
Arguments: | ||
[FILE]... The JavaScript file(s) to be evaluated | ||
|
||
Options: | ||
--strict Run in strict mode | ||
-a, --dump-ast [<FORMAT>] Dump the AST to stdout with the given format [possible values: debug, json, json-pretty] | ||
-t, --trace Dump the AST to stdout with the given format | ||
--vi Use vi mode in the REPL | ||
-O, --optimize | ||
--optimizer-statistics | ||
--flowgraph [<FORMAT>] Generate instruction flowgraph. Default is Graphviz [possible values: graphviz, mermaid] | ||
--flowgraph-direction <FORMAT> Specifies the direction of the flowgraph. Default is top-top-bottom [possible values: top-to-bottom, bottom-to-top, left-to-right, right-to-left] | ||
--debug-object Inject debugging object `$boa` | ||
-m, --module Treats the input files as modules | ||
-r, --root <ROOT> Root path from where the module resolver will try to load the modules [default: .] | ||
-h, --help Print help (see more with '--help') | ||
-V, --version Print version | ||
``` | ||
|
||
## Features | ||
|
||
Boa's CLI currently has a variety of features (as listed in `Options`). | ||
|
||
Features include: | ||
|
||
- Implemented runtime features (please note that only `Console` is currently implemented) | ||
- AST Visibility: View the compiled Boa AST (--dump-ast) | ||
- Tracing: Enabling a vm tracing when executing any JavaScript | ||
- Flowgraphs: View a generated (with various provided options) | ||
- Debugging: Boa's CLI comes with an implemented `$boa` debug object with various functionality (see documentation). | ||
|
||
Have an idea for a feature? Feel free to submit an issue and/or contribute! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it's wrapped in a function, I Would prefer using the
?
error propagation and making main return a JsResult.If not then using a display method that does not return a result
res.display()
we can also remove the.to_std_string_escaped()
since it implementsDisplay