Version of Warden
0.14.3
Operating System and Installation Method
Mac OS 14.3.1 via Brew
Describe the Bug
The default command fallback mechanism allow you to locally override any command for your current environment
if (( "$#" )); then
## local project directory if running within one; don't fail if it can't be found
WARDEN_ENV_PATH="$(locateEnvPath 2>/dev/null)" || true
if [[ -f "${WARDEN_ENV_PATH}/.warden/commands/${1}.cmd" ]]; then
WARDEN_CMD_VERB="$1"
WARDEN_CMD_ANYARGS+=("$1")
WARDEN_CMD_EXEC="${WARDEN_ENV_PATH}/.warden/commands/${1}.cmd"
WARDEN_CMD_HELP="${WARDEN_ENV_PATH}/.warden/commands/${1}.help"
shift
elif [[ -f "${WARDEN_HOME_DIR}/commands/${1}.cmd" ]]; then
WARDEN_CMD_VERB="$1"
WARDEN_CMD_ANYARGS+=("$1")
WARDEN_CMD_EXEC="${WARDEN_HOME_DIR}/commands/${1}.cmd"
WARDEN_CMD_HELP="${WARDEN_HOME_DIR}/commands/${1}.help"
shift
elif [[ -f "${WARDEN_DIR}/commands/${1}.cmd" ]]; then
WARDEN_CMD_VERB="$1"
WARDEN_CMD_EXEC="${WARDEN_DIR}/commands/${1}.cmd"
WARDEN_CMD_HELP="${WARDEN_DIR}/commands/${1}.help"
shift
else
WARDEN_HELP=1
fi
else
WARDEN_HELP=1
fi
This works fine when you have your environment initialized already and .env file is present (as it actively search for .env file inside the locateEnvPath. But if you want to initialize your environment first part of the if condition will actually search for /.warden/commands/${1}.cmd (root folder).
I believe it is reasonable to adjust the check to search in the ./.warden/commands/${1}.cmd current folder instead. This way it will be possible to override env-init command as well
To Reproduce
- In any empty folder create
.warden/commands/env-init.cmd and .warden/commands/env-init.help files
- While inside that folder run
warden env-init --help or warden env-init
- Actual result: fallback to your home folder or core warden command / help files happens.
Expected Behavior
Expected result: your local newly created files are called
Additional context
No response
Version of Warden
0.14.3
Operating System and Installation Method
Mac OS 14.3.1 via Brew
Describe the Bug
The default command fallback mechanism allow you to locally override any command for your current environment
This works fine when you have your environment initialized already and
.envfile is present (as it actively search for.envfile inside thelocateEnvPath. But if you want to initialize your environment first part of theifcondition will actually search for/.warden/commands/${1}.cmd(root folder).I believe it is reasonable to adjust the check to search in the
./.warden/commands/${1}.cmdcurrent folder instead. This way it will be possible to overrideenv-initcommand as wellTo Reproduce
.warden/commands/env-init.cmdand.warden/commands/env-init.helpfileswarden env-init --helporwarden env-initExpected Behavior
Expected result: your local newly created files are called
Additional context
No response