echo 'project_name := `basename "$(pwd)"`' > justfile &&
echo '' >> justfile &&
echo '# just search "just a <search_str>"(cargo install ripgrep)' >> justfile &&
echo 'a SEARCH:' >> justfile &&
echo ' just -l | rg -i {{SEARCH}}' >> justfile &&
echo '' >> justfile &&
echo '# "rustup show" & remove toolchains' >> justfile &&
echo 'toolremove TOOLCHAINS:' >> justfile &&
echo ' rustup toolchain remove {{TOOLCHAINS}}' >> justfile &&
echo '' >> justfile &&
echo '# rust-analyzer is available in rustup:' >> justfile &&
echo 'rupdate:' >> justfile &&
echo ' rustup component add rust-analyzer' >> justfile &&
echo '' >> justfile &&
echo '# rust-lang(rustc) update stable' >> justfile &&
echo 'rustupdate:' >> justfile &&
echo ' rustup update stable' >> justfile &&
echo '' >> justfile &&
echo '# cargo doc (documentation preview)' >> justfile &&
echo 'doc:' >> justfile &&
echo ' cargo doc --open' >> justfile &&
echo '' >> justfile &&
echo '# cargo run' >> justfile &&
echo 'r:' >> justfile &&
echo ' cargo r' >> justfile &&
echo '' >> justfile &&
echo '# (optimization)cargo run --release' >> justfile &&
echo 'rr:' >> justfile &&
echo ' cargo run --release' >> justfile &&
echo '' >> justfile &&
echo '# cargo watch(check & test & run)' >> justfile &&
echo 'w:' >> justfile &&
echo ' cargo watch -x check -x test -x run' >> justfile &&
echo '' >> justfile &&
echo '# cargo watch(simple only run)' >> justfile &&
echo 'ws:' >> justfile &&
echo " cargo watch -x 'run'" >> justfile &&
echo '' >> justfile &&
echo '# final review' >> justfile &&
echo 'fi:' >> justfile &&
echo ' cargo fmt --all -- --check' >> justfile &&
echo ' cargo check --all-features --all-targets --all' >> justfile &&
echo ' cargo doc --open' >> justfile &&
echo ' cargo nextest run --all-features --no-fail-fast --workspace --no-capture' >> justfile &&
echo ' cargo clippy --all-features --all-targets -- -D warnings' >> justfile &&
echo ' cargo audit' >> justfile &&
echo '' >> justfile &&
echo '# cargo check(Test Before Deployment)' >> justfile &&
echo 'c:' >> justfile &&
echo ' cargo check --all-features --all-targets --all' >> justfile &&
echo '' >> justfile &&
echo '# cargo test' >> justfile &&
echo 't:' >> justfile &&
echo ' cargo t' >> justfile &&
echo '' >> justfile &&
echo '# cargo expand(test --lib)' >> justfile &&
echo 'tex:' >> justfile &&
echo ' cargo expand --lib --tests' >> justfile &&
echo '' >> justfile &&
echo '# cargo test -- --nocapture' >> justfile &&
echo 'tp:' >> justfile &&
echo ' cargo t -- --nocapture' >> justfile &&
echo '' >> justfile &&
echo '# nightly(cargo nextest run)' >> justfile &&
echo 'tn:' >> justfile &&
echo ' cargo nextest run' >> justfile &&
echo '' >> justfile &&
echo '# nightly(cargo nextest run --nocapture)' >> justfile &&
echo 'tnp:' >> justfile &&
echo ' cargo nextest run --nocapture' >> justfile &&
echo '' >> justfile &&
echo '# macro show(cargo expand)' >> justfile &&
echo 'ex:' >> justfile &&
echo ' cargo expand' >> justfile &&
echo '' >> justfile &&
echo '# emit mir file' >> justfile &&
echo 'mir:' >> justfile &&
echo ' cargo rustc -- -Zunpretty=mir > target/{{project_name}}.mir' >> justfile &&
echo '' >> justfile &&
echo '# emit asm file' >> justfile &&
echo 'es:' >> justfile &&
echo ' cargo rustc -- --emit asm=target/{{project_name}}.s' >> justfile &&
echo '' >> justfile &&
echo '# optimized assembly' >> justfile &&
echo 'eos:' >> justfile &&
echo ' cargo rustc --release -- --emit asm > target/{{project_name}}.s' >> justfile &&
echo '' >> justfile &&
echo '# emit llvm-ir file' >> justfile &&
echo 'llvm:' >> justfile &&
echo ' cargo rustc -- --emit llvm-ir=target/{{project_name}}.ll' >> justfile &&
echo '' >> justfile &&
echo '# emit hir file' >> justfile &&
echo 'hir:' >> justfile &&
echo ' cargo rustc -- -Zunpretty=hir > target/{{project_name}}.hir' >> justfile &&
echo '' >> justfile &&
echo '# cargo asm' >> justfile &&
echo 'asm METHOD:' >> justfile &&
echo ' cargo asm {{project_name}}::{{METHOD}}' >> justfile &&
echo '' >> justfile &&
echo '# (nightly)clang sanitize(ASan=address / LSan=leak / TSan=thread / MSan=memory / UBSan=undefined)' >> justfile &&
echo '[linux]' >> justfile &&
echo 'san SAN:' >> justfile &&
echo ' export RUSTFLAGS=-Zsanitizer={{SAN}} RUSTDOCFLAGS=-Zsanitizer={{SAN}}' >> justfile &&
echo ' just n' >> justfile &&
echo ' cargo run -Zbuild-std --target x86_64-unknown-linux-gnu' >> justfile &&
echo '' >> justfile &&
echo '# hex view("rg -i <search>" | "grep -rni <search>")' >> justfile &&
echo 'xx:' >> justfile &&
echo ' cargo r' >> justfile &&
echo ' xxd -c 16 ./target/debug/{{project_name}} > ./target/debug/hex_print.txt' >> justfile &&
echo '' >> justfile &&
echo '# hex view(cat "SEARCH" | rg -i --line-number --color=always "SEARCH"("rg -i <search>"))' >> justfile &&
echo 'xv STR:' >> justfile &&
echo ' just xx' >> justfile &&
echo ' cat ./target/debug/hex_print.txt | rg -i --line-number --color=always {{STR}}' >> justfile &&
echo '' >> justfile &&
echo '# clean file' >> justfile &&
echo 'clean:' >> justfile &&
echo ' rm -rf target ./config rust-toolchain.toml *.lock' >> justfile &&
echo '' >> justfile &&
echo '# nightly setting(faster compilation)' >> justfile &&
echo 'n:' >> justfile &&
echo ' rm -rf .cargo rust-toolchain.toml' >> justfile &&
echo ' mkdir .cargo' >> justfile &&
echo ' echo "[toolchain]" >> rust-toolchain.toml' >> justfile &&
echo ' echo "channel = \"nightly\"" >> rust-toolchain.toml' >> justfile &&
echo ' echo "components = [\"rustfmt\", \"rust-src\"]" >> rust-toolchain.toml' >> justfile &&
echo ' echo "[build]" >> .cargo/config.toml' >> justfile &&
echo ' echo "rustflags = [\"-Z\", \"threads=8\"]" >> .cargo/config.toml' >> justfile &&
echo '' >> justfile &&
echo '# .gitignore setting' >> justfile &&
echo 'gi:' >> justfile &&
echo ' echo "# Result" >> README.md' >> justfile &&
echo ' echo "" >> README.md' >> justfile &&
echo ' echo "\`\`\`bash" >> README.md' >> justfile &&
echo ' echo "" >> README.md' >> justfile &&
echo ' echo "\`\`\`" >> README.md' >> justfile &&
echo ' echo "" >> README.md' >> justfile &&
echo ' echo "# Visual Studio 2015/2017 cache/options directory" >> .gitignore' >> justfile &&
echo ' echo ".vs/" >> .gitignore' >> justfile &&
echo ' echo "" >> .gitignore' >> justfile &&
echo ' echo "# A collection of useful .gitignore templates " >> .gitignore' >> justfile &&
echo ' echo "# https://github.com/github/gitignore" >> .gitignore' >> justfile &&
echo ' echo "# General" >> .gitignore' >> justfile &&
echo ' echo ".DS_Store" >> .gitignore' >> justfile &&
echo ' echo "dir/otherdir/.DS_Store" >> .gitignore' >> justfile &&
echo ' echo "" >> .gitignore' >> justfile &&
echo ' echo "# VS Code files for those working on multiple tools" >> .gitignore' >> justfile &&
echo ' echo ".vscode/" >> .gitignore' >> justfile &&
echo ' echo "# Generated by Cargo" >> .gitignore' >> justfile &&
echo ' echo "# will have compiled files and executables" >> .gitignore' >> justfile &&
echo ' echo "debug/" >> .gitignore' >> justfile &&
echo ' echo "target/" >> .gitignore' >> justfile &&
echo ' echo "" >> .gitignore' >> justfile &&
echo ' echo "# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries" >> .gitignore' >> justfile &&
echo ' echo "# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html" >> .gitignore' >> justfile &&
echo ' echo "Cargo.lock" >> .gitignore' >> justfile &&
echo ' echo "" >> .gitignore' >> justfile &&
echo ' echo "# These are backup files generated by rustfmt" >> .gitignore' >> justfile &&
echo ' echo "**/*.rs.bk" >> .gitignore' >> justfile &&
echo ' echo "" >> .gitignore' >> justfile &&
echo ' echo "# MSVC Windows builds of rustc generate these, which store debugging information" >> .gitignore' >> justfile &&
echo ' echo "*.pdb" >> .gitignore' >> justfile &&
echo ' echo "" >> .gitignore' >> justfile &&
echo ' echo "# WASM" >> .gitignore' >> justfile &&
echo ' echo "pkg/" >> .gitignore' >> justfile &&
echo ' echo "/wasm-pack.log" >> .gitignore' >> justfile &&
echo ' echo "dist/" >> .gitignore' >> justfile