Skip to content

Commit

Permalink
Add alias option
Browse files Browse the repository at this point in the history
  • Loading branch information
matias-gonz committed Aug 13, 2024
1 parent 4c4caa1 commit fdc2e8d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions zk_toolbox/zkup/zkup
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ZKT_DIR=${ZKT_DIR:-"$BASE_DIR/.zkt"}
ZKT_BIN_DIR="$ZKT_DIR/bin"

ZKUP_SKIP_ZK_SUPERVISOR=0
ZKUP_ALIAS=0

BINS=(zk_inception zk_supervisor)

Expand All @@ -28,6 +29,10 @@ main() {
for bin in "${BINS[@]}"; do
success "Installed $bin to $ZKT_BIN_DIR/$bin"
done

if [ $ZKUP_ALIAS -eq 1 ]; then
create_alias
fi
}

PREREQUISITES=(cargo git)
Expand Down Expand Up @@ -80,6 +85,7 @@ parse_args() {
ZKUP_VERSION=$1
;;
--skip-zk-supervisor) ZKUP_SKIP_ZK_SUPERVISOR=1 ;;
--alias) ZKUP_ALIAS=1 ;;
-h | --help)
usage
exit 0
Expand Down Expand Up @@ -168,6 +174,16 @@ install_from_repo() {
fi
}

create_alias() {
say "Creating alias 'zki' for zk_inception"
ensure ln -sf "$ZKT_BIN_DIR/zk_inception" "$ZKT_BIN_DIR/zki"

if [ $ZKUP_SKIP_ZK_SUPERVISOR -eq 0 ]; then
say "Creating alias 'zks' for zk_supervisor"
ensure ln -sf "$ZKT_BIN_DIR/zk_supervisor" "$ZKT_BIN_DIR/zks"
fi
}

ensure() {
if ! "$@"; then
err "command failed: $*"
Expand Down

0 comments on commit fdc2e8d

Please sign in to comment.