nu script for gen rust project
This commit is contained in:
parent
44af71946e
commit
2099f58796
|
@ -1,14 +1,33 @@
|
||||||
#!/usr/bin/env nu
|
#!/usr/bin/env nu
|
||||||
|
|
||||||
|
## Generate a rust project with clap setup
|
||||||
def main [script: string] {
|
def main [script: string] {
|
||||||
cd /home/chris/dev
|
cd /home/chris/dev
|
||||||
mkdir $script
|
mkdir $script
|
||||||
cd $script
|
cd $script
|
||||||
git init
|
git init
|
||||||
nix flake init --template templates#rust
|
nix flake init --template github:nix-community/templates#rust
|
||||||
direnv allow
|
direnv allow .
|
||||||
echo "Try running this next:
|
direnv export json | from json | default {} | load-env
|
||||||
cargo init
|
cargo add clap --features=derive
|
||||||
cargo add clap --features=derive"
|
|
||||||
emacsclient /home/chris/dev/$script
|
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