sdkman / homebrew-tap

Apache License 2.0
38 stars 5 forks source link

Can't print version #3

Closed gerardo-cauich closed 2 months ago

gerardo-cauich commented 1 year ago

I followed these instructions on my Macbook, but by modifiying .zshrc rather than .bash-profile, and I got the following issue during sdk version:

gerardo@macbook ~ % sdk version
cat: /usr/local/opt/sdkman-cli/libexec/var/version: No such file or directory

SDKMAN 
gerardo@macbook ~ % 

And indeed that file doesn't exist.

Macbook: MacBook Pro 2020 (Intel) MacOS: Version 13.3.1 (22E261) SDKMAN: 5.18.1

All other commands appear to work though.

helpermethod commented 1 year ago

@marc0der has something changed with regards to the version (binary)?

gerardo-cauich commented 1 year ago

I also installed without Homebrew via https://sdkman.io/install and the sdk version command works fine.

helpermethod commented 1 year ago

I think the problem is related to the recent changes to the selfupdate mechanism. I'm already preparing a fix.

Thanks for reporting!

sdmoralesma commented 1 year ago

To report that it's still an issue: $ sdk version '/usr/local/opt/sdkman-cli/libexec/var/version': No such file or directory (os error 2)

ylluminate commented 1 year ago

Same problem here (I use bat vs cat + zsh):

$ sdk version
[bat error]: '/opt/homebrew/opt/sdkman-cli/libexec/var/version': No such file or directory (os error 2)

SDKMAN

Other commands such as install, list, etc. also all fail.

Prefer to use a package manager (eg Macports or Homebrew) to facilitate automatic updates for all pkgs vs recalling to update sdkman! by itself).

edosrecki commented 8 months ago

Same here, doesn't work when installing via Homebrew. Had to install using the official bash script.

hsahota93 commented 7 months ago

I am also running into this issue. After running the commands in the README, I get the below error when running sdk version

% sdk version
cat: /opt/homebrew/opt/sdkman-cli/libexec/var/version: No such file or directory

SDKMAN

However, I seem to be able to run commands fine. I just ran sdk install java and it was successful.

Additionally when I run which sdk it spits out a script.

% which sdk
sdk () {
    COMMAND="$1"
    QUALIFIER="$2"
    case "$COMMAND" in
        (l) COMMAND="list"  ;;
        (ls) COMMAND="list"  ;;
        (v) COMMAND="version"  ;;
        (u) COMMAND="use"  ;;
        (i) COMMAND="install"  ;;
        (rm) COMMAND="uninstall"  ;;
        (c) COMMAND="current"  ;;
        (ug) COMMAND="upgrade"  ;;
        (d) COMMAND="default"  ;;
        (h) COMMAND="home"  ;;
        (e) COMMAND="env"  ;;
    esac
    if [[ "$COMMAND" != "update" ]]
    then
        ___sdkman_check_candidates_cache "$SDKMAN_CANDIDATES_CACHE" || return 1
    fi
    SDKMAN_AVAILABLE="true"
    if [ -z "$SDKMAN_OFFLINE_MODE" ]
    then
        SDKMAN_OFFLINE_MODE="false"
    fi
    __sdkman_update_service_availability
    if [ -f "${SDKMAN_DIR}/etc/config" ]
    then
        source "${SDKMAN_DIR}/etc/config"
    fi
    if [[ -z "$COMMAND" ]]
    then
        ___sdkman_help
        return 1
    fi
    CMD_FOUND=""
    if [[ "$COMMAND" != "selfupdate" || "$sdkman_selfupdate_feature" == "true" ]]
    then
        CMD_TARGET="${SDKMAN_DIR}/src/sdkman-${COMMAND}.sh"
        if [[ -f "$CMD_TARGET" ]]
        then
            CMD_FOUND="$CMD_TARGET"
        fi
    fi
    CMD_TARGET="${SDKMAN_DIR}/ext/sdkman-${COMMAND}.sh"
    if [[ -f "$CMD_TARGET" ]]
    then
        CMD_FOUND="$CMD_TARGET"
    fi
    if [[ -z "$CMD_FOUND" ]]
    then
        echo ""
        __sdkman_echo_red "Invalid command: $COMMAND"
        echo ""
        ___sdkman_help
    fi
    if [[ -n "$QUALIFIER" && "$COMMAND" != "help" && "$COMMAND" != "offline" && "$COMMAND" != "flush" && "$COMMAND" != "selfupdate" && "$COMMAND" != "env" && "$COMMAND" != "completion" && "$COMMAND" != "edit" && "$COMMAND" != "home" && -z $(echo ${SDKMAN_CANDIDATES[@]} | grep -w "$QUALIFIER") ]]
    then
        echo ""
        __sdkman_echo_red "Stop! $QUALIFIER is not a valid candidate."
        return 1
    fi
    if [[ "$COMMAND" == "offline" && -n "$QUALIFIER" && -z $(echo "enable disable" | grep -w "$QUALIFIER") ]]
    then
        echo ""
        __sdkman_echo_red "Stop! $QUALIFIER is not a valid offline mode."
    fi
    local final_rc=0
    local native_command="${SDKMAN_DIR}/libexec/${COMMAND}"
    if [ -f "$native_command" ]
    then
        "$native_command" "${@:2}"
    elif [ -n "$CMD_FOUND" ]
    then
        local converted_command_name=$(echo "$COMMAND" | tr '-' '_')
        __sdk_"$converted_command_name" "${@:2}"
    fi
    final_rc=$?
    return $final_rc
}
Katherine620 commented 3 months ago

To report that it's still an issue: `sdk version cat: /opt/homebrew/opt/sdkman-cli/libexec/var/version: No such file or directory

SDKMAN`

marc0der commented 3 months ago

Hi @Katherine620, it looks like this tap is no longer maintained.

@helpermethod any thoughts? I think if we can't make it work, we should rather archive the project.

helpermethod commented 3 months ago

@marc0der Yes, we should probably archive the project for now. I have some ideas on how to make this work, but we can't use jreleaser for this anymore (as the formula would need to consume releases from two different projects).

helpermethod commented 3 months ago

Hi @Katherine620,

I've put in some time to rework the tap, it now prints the version and takes the (platform-dependent) native-extensions into account. PR is already open :).

davidfmatheson commented 3 months ago

Happy to test if there's a way to specify a branch on brew tap or brew install.

davidfmatheson commented 2 months ago

Forked, merged the bugfix branch on my fork, tapped it and installed sdkman. sdk version works!

dobrKot commented 2 months ago

Version is still not printed. Tapped and installed it today: oleksandryuvko@oylaptop ~ % sdk version cat: /opt/homebrew/opt/sdkman-cli/libexec/var/version: No such file or directory

SDKMAN

UPD: Oh, the PR is still on OPEN stage, I see.

davidfmatheson commented 2 months ago

Version is still not printed. Tapped and installed it today: oleksandryuvko@oylaptop ~ % sdk version cat: /opt/homebrew/opt/sdkman-cli/libexec/var/version: No such file or directory

SDKMAN

UPD: Oh, the PR is still on OPEN stage, I see.

You can try my test fork with brew tap davidfmatheson/tap. That's just taking the PR and merging the branch on my fork.

dobrKot commented 2 months ago

Version is still not printed. Tapped and installed it today: oleksandryuvko@oylaptop ~ % sdk version cat: /opt/homebrew/opt/sdkman-cli/libexec/var/version: No such file or directory SDKMAN UPD: Oh, the PR is still on OPEN stage, I see.

You can try my test fork with brew tap davidfmatheson/tap. That's just taking the PR and merging the branch on my fork.

Cool, thanks 👍

helpermethod commented 2 months ago

The PR has been merged and should fix most problems.