示例#1
0
def main():

    print(f"Brownie v{__version__} - Python development framework for Ethereum\n")

    # remove options before calling docopt
    if len(sys.argv) > 1 and sys.argv[1][0] != "-":
        idx = next((sys.argv.index(i) for i in sys.argv if i.startswith("-")), len(sys.argv))
        opts = sys.argv[idx:]
        sys.argv = sys.argv[:idx]
    args = docopt(__doc__)
    sys.argv += opts

    cmd_list = [i.stem for i in Path(__file__).parent.glob('[!_]*.py')]
    if args['<command>'] not in cmd_list:
        sys.exit("Invalid command. Try 'brownie --help' for available commands.")

    ARGV['cli'] = args['<command>']
    sys.modules['brownie'].a = network.accounts
    sys.modules['brownie'].__all__.append('a')

    try:
        importlib.import_module("brownie.cli."+args['<command>']).main()
    except ProjectNotFound:
        notify("ERROR", "Brownie environment has not been initiated for this folder.")
        print("Type 'brownie init' to create the file structure.")
    except Exception:
        print(color.format_tb(sys.exc_info()))
示例#2
0
def main():
    args = docopt(__doc__)
    path = project.pull(args['<mix>'], args['<path>'], args['--force'])
    notify("SUCCESS",
           f"Brownie mix '{args['<mix>']}' has been initiated at {path}")
示例#3
0
文件: init.py 项目: acolytec3/brownie
def main():
    args = docopt(__doc__)
    path = project.new(args["<path>"] or ".", args["--force"])
    notify("SUCCESS", f"Brownie environment has been initiated at {path}")
示例#4
0
def main():
    args = docopt(__doc__)
    path = project.new(args['<path>'] or '.', args['--force'])
    notify("SUCCESS", f"Brownie environment has been initiated at {path}")