Skip to content

Commit

Permalink
Bump README
Browse files Browse the repository at this point in the history
  • Loading branch information
udoprog committed Dec 16, 2020
1 parent b018b74 commit 5254d75
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 31 deletions.
21 changes: 7 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ you are working on it.
You can run Rune programs with the bundled CLI:

```
cargo run --bin rune -- scripts/hello_world.rn
cargo run --bin rune -- run scripts/hello_world.rn
```

If you want to see detailed diagnostics of your program while it's running,
you can use:

```
cargo run --bin rune -- scripts/hello_world.rn --dump-unit --trace --dump-vm
cargo run --bin rune -- run scripts/hello_world.rn --dump-unit --trace --dump-vm
```

See `--help` for more information.
Expand Down Expand Up @@ -122,23 +122,16 @@ async fn main() -> Result<(), Box<dyn Error>> {
"#,
));

let mut errors = rune::Errors::new();
let mut warnings = rune::Warnings::new();
let mut diagnostics = rune::Diagnostics::new();

let unit = match rune::load_sources(&context, &options, &mut sources, &mut errors, &mut warnings) {
Ok(unit) => unit,
Err(rune::LoadSourcesError) => {
let mut writer = StandardStream::stderr(ColorChoice::Always);
errors.emit_diagnostics(&mut writer, &sources)?;
return Ok(());
}
};
let result = rune::load_sources(&context, &options, &mut sources, &mut diagnostics);

if !warnings.is_empty() {
if !diagnostics.is_empty() {
let mut writer = StandardStream::stderr(ColorChoice::Always);
warnings.emit_diagnostics(&mut writer, &sources)?;
diagnostics.emit_diagnostics(&mut writer, &sources)?;
}

let unit = result?;
let vm = Vm::new(Arc::new(context.runtime()), Arc::new(unit));

let mut execution = vm.execute(&["calculate"], (10i64, 20i64))?;
Expand Down
21 changes: 7 additions & 14 deletions crates/rune/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ you are working on it.
You can run Rune programs with the bundled CLI:

```
cargo run --bin rune -- scripts/hello_world.rn
cargo run --bin rune -- run scripts/hello_world.rn
```

If you want to see detailed diagnostics of your program while it's running,
you can use:

```
cargo run --bin rune -- scripts/hello_world.rn --dump-unit --trace --dump-vm
cargo run --bin rune -- run scripts/hello_world.rn --dump-unit --trace --dump-vm
```

See `--help` for more information.
Expand Down Expand Up @@ -122,23 +122,16 @@ async fn main() -> Result<(), Box<dyn Error>> {
"#,
));

let mut errors = rune::Errors::new();
let mut warnings = rune::Warnings::new();
let mut diagnostics = rune::Diagnostics::new();

let unit = match rune::load_sources(&context, &options, &mut sources, &mut errors, &mut warnings) {
Ok(unit) => unit,
Err(rune::LoadSourcesError) => {
let mut writer = StandardStream::stderr(ColorChoice::Always);
errors.emit_diagnostics(&mut writer, &sources)?;
return Ok(());
}
};
let result = rune::load_sources(&context, &options, &mut sources, &mut diagnostics);

if !warnings.is_empty() {
if !diagnostics.is_empty() {
let mut writer = StandardStream::stderr(ColorChoice::Always);
warnings.emit_diagnostics(&mut writer, &sources)?;
diagnostics.emit_diagnostics(&mut writer, &sources)?;
}

let unit = result?;
let vm = Vm::new(Arc::new(context.runtime()), Arc::new(unit));

let mut execution = vm.execute(&["calculate"], (10i64, 20i64))?;
Expand Down
4 changes: 2 additions & 2 deletions crates/rune/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@
//! You can run Rune programs with the bundled CLI:
//!
//! ```text
//! cargo run --bin rune -- scripts/hello_world.rn
//! cargo run --bin rune -- run scripts/hello_world.rn
//! ```
//!
//! If you want to see detailed diagnostics of your program while it's running,
//! you can use:
//!
//! ```text
//! cargo run --bin rune -- scripts/hello_world.rn --dump-unit --trace --dump-vm
//! cargo run --bin rune -- run scripts/hello_world.rn --dump-unit --trace --dump-vm
//! ```
//!
//! See `--help` for more information.
Expand Down
2 changes: 1 addition & 1 deletion scripts/hello_world.rn
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub fn main() {
println("Hello World");
println!("Hello World");
}

0 comments on commit 5254d75

Please sign in to comment.