예제 #1
0
def get_seed_file(cmd_args, nargs, invoked_as=None):
    from mmgen.filename import find_file_in_dir
    from mmgen.seed import Wallet
    wf = find_file_in_dir(Wallet, g.data_dir)

    wd_from_opt = bool(opt.hidden_incog_input_params
                       or opt.in_fmt)  # have wallet data from opt?

    import mmgen.opts as opts
    if len(cmd_args) + (wd_from_opt or bool(wf)) < nargs:
        opts.usage()
    elif len(cmd_args) > nargs:
        opts.usage()
    elif len(cmd_args) == nargs and wf and invoked_as != 'gen':
        msg('Warning: overriding default wallet with user-supplied wallet')

    if cmd_args or wf:
        check_infile(cmd_args[0] if cmd_args else wf)

    return cmd_args[0] if cmd_args else (wf, None)[wd_from_opt]
예제 #2
0
파일: util.py 프로젝트: mmgen/mmgen
def get_seed_file(cmd_args,nargs,invoked_as=None):
	from mmgen.filename import find_file_in_dir
	from mmgen.seed import Wallet

	wf = find_file_in_dir(Wallet,g.data_dir)

	wd_from_opt = bool(opt.hidden_incog_input_params or opt.in_fmt) # have wallet data from opt?

	import mmgen.opts as opts
	if len(cmd_args) + (wd_from_opt or bool(wf)) < nargs:
		if not wf:
			msg('No default wallet found, and no other seed source was specified')
		opts.usage()
	elif len(cmd_args) > nargs:
		opts.usage()
	elif len(cmd_args) == nargs and wf and invoked_as != 'gen':
		qmsg('Warning: overriding default wallet with user-supplied wallet')

	if cmd_args or wf:
		check_infile(cmd_args[0] if cmd_args else wf)

	return cmd_args[0] if cmd_args else (wf,None)[wd_from_opt]