Comments (2)
Does process substitution do what you need?
$ rust-script <(echo 'println!("Hello '"$USER"'!");')
Hello gjum!
from rust-script.
🤔 Hm... maybe I'm holding it wrong or the inner shell is messing up the outer one but this fails:
rust-script <( sed 's/PKG/ssh-openpgp-auth/g;s/KIND/shell_completions/g' <<< '//! ```cargo
//! [dependencies]
//! pkg = { path = "PKG", package = "PKG" }
//! clap_allgen = "0.1.0"
//! ```
fn main() -> Result<(), Box<dyn std::error::Error>> {
clap_allgen::render_KIND::<pkg::Commands>(
&std::env::args().collect::<Vec<_>>()[1],
)?;
Ok(())
}
' ) '/tmp/xxz'
The error is:
error: failed to get `ssh-openpgp-auth` as a dependency of package `_63_d589d09bfb5f45ea9b4b85e0 v0.1.0 (/home/wiktor/.cache/rust-script/projects/d589d09bfb5f45ea9b4b85e0)`
Caused by:
failed to load source for dependency `ssh-openpgp-auth`
Caused by:
Unable to update /dev/fd/ssh-openpgp-auth
Caused by:
failed to read `/dev/fd/ssh-openpgp-auth/Cargo.toml`
Caused by:
No such file or directory (os error 2)
error: Could not execute cargo
The following works:
sed 's/PKG/ssh-openpgp-auth/g;s/KIND/shell_completions/g' > .script.rs <<< '//! ```cargo
//! [dependencies]
//! pkg = { path = "PKG", package = "PKG" }
//! clap_allgen = "0.1.0"
//! ```
fn main() -> Result<(), Box<dyn std::error::Error>> {
clap_allgen::render_KIND::<pkg::Commands>(
&std::env::args().collect::<Vec<_>>()[1],
)?;
Ok(())
}
'
rust-script .script.rs '/tmp/xxz'
rm --force .script.rs
Just for the record I'm modifying this file.
Thanks for your time! 👋
from rust-script.
Related Issues (20)
- Run Hidden (On Windows) HOT 6
- Multiple dependencies not supported HOT 1
- Justfile integration HOT 5
- ability to compile a script as a library HOT 2
- First CLI Argument should contain name of script instead of compiled binary HOT 1
- Configure the build options
- Include built binaries in releases HOT 2
- Website dead link `https://archlinux.org/packages/community/x86_64/rust-script/` HOT 1
- Path dependencies are not recompiled when modified HOT 1
- Document cache location
- Obtaining the path to a script and/or its containing directory through a symlink
- Inconsistent Caching Behaviour with Path Dependencies
- Provide Debian package in Releases
- Option to purge orphaned packages and artifacts
- Support for .env file?
- Feat: shortcut rust-script command name HOT 1
- Friendlier compilation progress
- Main function recognition HOT 1
- no_std support with extern main HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust-script.