Skip to content

Commit 00b139d

Browse files
authored
Update README.md
1 parent b1d5234 commit 00b139d

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

docs/README.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,20 +112,15 @@ If you want to make a script usable across platforms, use *both* a hashbang line
112112

113113
## Expressions
114114

115-
`rust-script` can also run pieces of Rust code directly from the command line. This is done by providing the `-e`/`--eval` option; this causes `rust-script` to interpret the `<script>` argument as source code *instead* of as a file path.
116-
117-
The - `-d`/`--dep` option can be used to specify dependencies to add before evaluating the expression.
118-
119-
120-
For example, code can be executed from the command line in a number of ways:
115+
Using the `-e`/`--eval` option a Rust expression can be evaluated directly, with optionally dependencies added using the `-d`/`--dep` option:
121116

122117
```sh
123118
$ rust-script -e '1+2'
124119
3
125120
$ rust-script --dep time --expr "time::OffsetDateTime::now_utc().format(time::Format::Rfc3339).to_string()"`
126121
"2020-10-28T11:42:10+00:00"
127-
$ # Use a specific version of the time crate instead of latest:
128-
$ rust-script --dep time=0.1.38 --e "time::now().rfc822z().to_string()"
122+
$ # Use a specific version of the time crate (instead of default latest):
123+
$ rust-script --dep time=0.1.38 -e "time::now().rfc822z().to_string()"
129124
"2020-10-28T11:42:10+00:00"
130125
```
131126

0 commit comments

Comments
 (0)