34 lines
721 B
Plaintext
Executable file
34 lines
721 B
Plaintext
Executable file
#!/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 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
|
|
|
|
}
|