Changed:
- Implemented work-around for issue 50. See the section in the
READMEon known issues.
New:
- Several environment variables are now given to scripts by
cargo-script.
Changed:
- Overhauled
README.md.
Fixed:
- Warning in the new
exprtemplate.
Fixed:
- Incompatibility with the version of Cargo shipped with Rust 1.16.0.
New:
-
Added support for expression script templates.
-
The built-in templates used for scripts can be overridden.
Fixed:
- Cargo script hanging on build failure on Windows.
New:
- Expressions can now use
try!/?for propagating errors.
Fixed:
- Suspiciously absent 0.2.2 features.
Fixed:
-
cargo-scriptno longer gets confused when trying to run scripts with non-identifier characters in their name. -
Coloured output from
cargonow works on *nix. -
Relative paths in manifests for dependencies are now supported.
Changed:
cargo-scriptnow interrogatescargoto find out where it puts the compiled executables. This should makecargo-scriptmore robust. This only works with Rust 1.17 or higher.
New:
-
Added
--testand--benchflags. These can be used to run a script's tests and benchmarks. -
Added
cargo-script file-associationsubcommand for managing file associations on Windows. -
If compiled with the
suppress-cargo-outputfeature,cargo-scriptwill hide output from Cargo if the build takes less than 2 seconds and succeeds.
Changed:
-
cargo-scriptnow requires Rust 1.11 to build. -
Removed prefix manifests. All other forms are still supported.
-
The cache location on not-Windows when
CARGO_HOMEis defined is now$CARGO_HOME, rather than$CARGO_HOME/.cargo. Existing data may be migrated to the new location using the--migrate-dataoption.
Fixed:
-
The result of an
--exprinvocation now lives longer, allowing borrowed values to be displayed more easily. -
Fixed issue with expressions containing commas on the command line.
New:
-
cargo-scriptnow (typically) defaults to using a shared build location. This means that, provided you're using the same compiler, dependencies won't need to be constantly re-built. This can be explicitly controlled by setting the--use-shared-binary-cacheoption toyesorno. -
Added
--unstable-featureoption. This allows you to specify unstable language features that should be enabled.
Changed:
- The build cache will be retained when the build fails. This means that dependencies don't have to be re-built when the script itself has an error in it.
Fixed:
- Fixed issue with evaluating an expression containing macros that capture.
New:
- Added
--featuresoption. This allows you to specify the features that should be enabled.
Fixed:
cargo-scriptshould now build with Rust 1.4 stable or higher. Rust 1.3 is incompatible due to the breaking change to the behaviour ofstr::lines.
New:
run-cargo-scripttrampoline program for use with hashbangs.
Changed:
-
On UNIX,
cargo-scriptwill now try to place its cache in$CARGO_HOME, falling back to$HOME. Behaviour on Windows is unchanged. -
Various internal fixes and updates.
New:
-
Added
-eand-las shorthands for--exprand--loop. -
Added
--dep-extern/-D. This introduces a dependency and causes an appropriate#[macro_use] extern crate $name;item to be added. This only applies to expression and loop scripts. -
Added
--extern/-x. This adds a explicit#[macro_use] extern crate $nameitem. This only applies to expression and loop scripts.
New:
-
Not-Windows support, contributed by @Ryman.
-
Added support for two new embedded manifest formats: short comment manifests and code block manifests. Compared to prefix manifests, these have the advantage of allowing scripts to be valid Rust code, as well as having a measure of self-documentation.
-
You can now pass arguments to scripts. If you want to pass switches, you'll need to add
--after the script name socargo scriptknows to stop looking for switches. -
Added the
--clear-cacheflag. This deletes all cached scripts. It can be provided by itself or as part of a regular invocation. -
Added the
--pkg-path PATHflag. This lets you specify where to create the Cargo package. -
Added the
--gen-pkg-onlyflag. This causescargo scriptto output a Cargo package, but not attempt to build or run it.
Changed:
-
Expressions and loop closures are now wrapped in blocks, rather than an expression. This means you can have multiple statements, link to crates, use things, etc. without having to define a block yourself.
-
Expressions now have their output displayed using the
{:?}format specifier. This allows more types to work without extra effort, but does make strings a bit ugly. -
Changed to a not-as-slow argument parser.
Removed:
- Removed content hashing for scripts. No longer will even minor changes cause Cargo to go back and re-fetch and re-compile all dependencies! Scripts are cached based on a hash of their absolute path, instead. Expressions and loop closures are still cached based on a content hash.