Files
depot/tools/meson/install-cli-assets.sh
T
SFG545 5b23ea95e0 Update dependencies, improve CLI asset generation, and add man page
- Bump `git2` from 0.20.4 to 0.21.0 and `rusqlite` from 0.39.0 to 0.40.1 in Cargo.toml.
- Refactor CLI asset generation in `cli_assets.rs` to write a man page directly instead of generating it with `clap_mangen`.
- Implement a function to remove old man pages before writing the new one.
- Add tests to ensure the generated man page documents all visible command paths.
- Update the install script to copy the newly generated man page correctly.
- Introduce a new man page for the `depot` command with comprehensive documentation.
2026-06-10 06:33:39 -05:00

47 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
if [ "$#" -ne 5 ]; then
echo "usage: $0 <depot-bin> <bash-dir> <zsh-dir> <fish-dir> <man1-dir>" >&2
exit 2
fi
depot_bin="$1"
bash_dir="$2"
zsh_dir="$3"
fish_dir="$4"
man1_dir="$5"
if [ ! -x "$depot_bin" ]; then
echo "error: depot binary is not executable: $depot_bin" >&2
exit 1
fi
if [ -z "${MESON_INSTALL_DESTDIR_PREFIX:-}" ]; then
echo "error: MESON_INSTALL_DESTDIR_PREFIX is not set" >&2
exit 1
fi
resolve_dest() {
case "$1" in
/*) printf '%s%s\n' "${DESTDIR:-}" "$1" ;;
*) printf '%s/%s\n' "$MESON_INSTALL_DESTDIR_PREFIX" "$1" ;;
esac
}
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
"$depot_bin" generate-artifacts --out-dir "$tmpdir"
bash_dest="$(resolve_dest "$bash_dir")"
zsh_dest="$(resolve_dest "$zsh_dir")"
fish_dest="$(resolve_dest "$fish_dir")"
man_dest="$(resolve_dest "$man1_dir")"
mkdir -p "$bash_dest" "$zsh_dest" "$fish_dest" "$man_dest"
cp "$tmpdir/depot.bash" "$bash_dest/depot"
cp "$tmpdir/_depot" "$zsh_dest/_depot"
cp "$tmpdir/depot.fish" "$fish_dest/depot.fish"
cp "$tmpdir/depot.1" "$man_dest/depot.1"