Skip to content

Commit

Permalink
Support --version
Browse files Browse the repository at this point in the history
  • Loading branch information
eternauta1337 committed Mar 9, 2024
1 parent d30e12c commit bbe97e2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/ethernaut-cli/ethernaut
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bbe97e2

Please sign in to comment.