nu script for gen rust project
This commit is contained in:
parent
44af71946e
commit
2099f58796
|
@ -1,14 +1,33 @@
|
|||
#!/usr/bin/env nu
|
||||
|
||||
## Generate a rust project with clap setup
|
||||
def main [script: string] {
|
||||
cd /home/chris/dev
|
||||
mkdir $script
|
||||
cd $script
|
||||
git init
|
||||
nix flake init --template templates#rust
|
||||
direnv allow
|
||||
echo "Try running this next:
|
||||
cargo init
|
||||
cargo add clap --features=derive"
|
||||
emacsclient /home/chris/dev/$script
|
||||
nix flake init --template github:nix-community/templates#rust
|
||||
direnv allow .
|
||||
direnv export json | from json | default {} | load-env
|
||||
cargo add clap --features=derive
|
||||
|
||||
echo 'use clap::Parser;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[clap(version)]
|
||||
struct Args {
|
||||
#[clap(short, long, help = "Video to convert")]
|
||||
video: Option<PathBuf>,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args = Args::parse();
|
||||
println!("{:?}", args);
|
||||
}
|
||||
' | save -f src/main.rs
|
||||
|
||||
sed -i $"s/projectname/($script)/g" Cargo.toml
|
||||
emacsclient -n ./src/main.rs
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue