Add -V and --version myth CLI option

pull/359/head
rocky 6 years ago
parent f81ca73b92
commit 372bc9e6a6
  1. 9
      mythril/interfaces/cli.py
  2. 3
      mythril/version.py
  3. 9
      setup.py

@ -1,5 +1,5 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# -*- coding: utf-8 -*-
"""mythril.py: Bug hunting on the Ethereum blockchain
http://www.github.com/ConsenSys/mythril
@ -14,6 +14,7 @@ import argparse
from mythril.exceptions import CriticalError
from mythril.mythril import Mythril
from mythril.version import VERSION
def exit_with_error(format, message):
@ -31,6 +32,8 @@ def main():
commands = parser.add_argument_group('commands')
commands.add_argument('-g', '--graph', help='generate a control flow graph')
commands.add_argument('-V', '--version', action='store_true',
help='print the Mythril version number and exit')
commands.add_argument('-x', '--fire-lasers', action='store_true',
help='detect vulnerabilities, use with -c, -a or solidity file(s)')
commands.add_argument('-t', '--truffle', action='store_true',
@ -84,6 +87,10 @@ def main():
args = parser.parse_args()
if args.version:
print("Mythril version {}".format(VERSION))
sys.exit()
# -- args sanity checks --
# Detect unsupported combinations of command line args

@ -0,0 +1,3 @@
# This file is suitable for sourcing inside POSIX shell, e.g. bash as
# well as for importing into Python
VERSION = "v0.18.9"

@ -1,13 +1,18 @@
from setuptools import setup, find_packages
from setuptools.command.install import install
from pathlib import Path
import sys
import os
# To make lint checkers happy we set VERSION here, but
# it is redefined by the exec below
VERSION = None
# Package version (vX.Y.Z). It must match git tag being used for CircleCI
# deployment; otherwise the build will failed.
VERSION = "v0.18.9"
version_path = (Path(__file__).parent / 'mythril' / 'version.py').absolute()
exec(open(version_path, 'r').read())
class VerifyVersionCommand(install):
"""Custom command to verify that the git tag matches our version"""

Loading…
Cancel
Save