From bbe97e2819e1f0d2883480d186616f7883bbd6bb Mon Sep 17 00:00:00 2001 From: Alejandro Date: Sat, 9 Mar 2024 19:51:31 -0300 Subject: [PATCH] Support --version --- packages/ethernaut-cli/ethernaut | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/ethernaut-cli/ethernaut b/packages/ethernaut-cli/ethernaut index 0e13a48b..7b83e35e 100755 --- a/packages/ethernaut-cli/ethernaut +++ b/packages/ethernaut-cli/ethernaut @@ -3,6 +3,17 @@ execDir=$(pwd) fileDir=$(dirname $0) cd $fileDir +# Check if --version is in argv +for arg in "$@" +do + if [ "$arg" == "--version" ] || [ "$arg" == "-v" ]; then + # Print the package.json version + version=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]') + echo "ethernaut-cli v$version" + exit 0 + fi +done + # Check if hardhat.config.js exists in the current directory if [ ! -f hardhat.config.js ]; then # If not, change directory to the global npm package location