add func cargo-init

This commit is contained in:
thek4n 2026-03-01 17:49:35 +03:00
parent 845f83c3e0
commit 06e80254bd

View File

@ -62,16 +62,13 @@ top-commands() {
}' | sort | uniq -c | sort -nr | sed 's/^[[:space:]]*//' }' | sort | uniq -c | sort -nr | sed 's/^[[:space:]]*//'
} }
ci() { cargo-init() {
# Create cargo project (cargo init)
if [[ -v 1 ]]; then if [[ -v 1 ]]; then
cargo init "${1}" && cd "${1}" cargo init "${1}" && cd "${1}" && \
return "${?}" return "${?}"
fi fi
local -r mktemp_template='thek4n-rust-XXXXXX' local -r temp="/tmp/thek4n-rust-${RANDOM}"
local temp mkdir "${temp}" && cd "${temp}" && cargo init . && \
temp="$(mktemp -dt "${mktemp_template}")" && \ return "${?}"
cd "${temp}" && \
cargo init .
} }