def getaddrs(header, ask=False, default=None): configkey = header.lower() opt = header.replace(b'-', b'_').lower() addrs = opts.get(opt) if addrs: showaddrs.append(b'%s: %s' % (header, b', '.join(addrs))) return mail.addrlistencode(ui, addrs, _charsets, opts.get(b'test')) # not on the command line: fallback to config and then maybe ask addr = ui.config(b'email', configkey) or ui.config( b'patchbomb', configkey ) if not addr: specified = ui.hasconfig(b'email', configkey) or ui.hasconfig( b'patchbomb', configkey ) if not specified and ask: addr = prompt(ui, header, default=default) if addr: showaddrs.append(b'%s: %s' % (header, addr)) return mail.addrlistencode(ui, [addr], _charsets, opts.get(b'test')) elif default: return mail.addrlistencode( ui, [default], _charsets, opts.get(b'test') ) return []
def getaddrs(opt, prpt=None, default=None): if opts.get(opt): return mail.addrlistencode(ui, opts.get(opt), _charsets, opts.get('test')) addrs = (ui.config('email', opt) or ui.config('patchbomb', opt) or '') if not addrs and prpt: addrs = prompt(ui, prpt, default) return mail.addrlistencode(ui, [addrs], _charsets, opts.get('test'))
def getaddrs(header, ask=False, default=None): configkey = header.lower() opt = header.replace('-', '_').lower() addrs = opts.get(opt) if addrs: showaddrs.append('%s: %s' % (header, ', '.join(addrs))) return mail.addrlistencode(ui, addrs, _charsets, opts.get('test')) # not on the command line: fallback to config and then maybe ask addr = (ui.config('email', configkey) or ui.config('patchbomb', configkey) or '') if not addr and ask: addr = prompt(ui, header, default=default) if addr: showaddrs.append('%s: %s' % (header, addr)) return mail.addrlistencode(ui, [addr], _charsets, opts.get('test')) else: return default
def getaddrs(opt, prpt=None, default=None): addrs = opts.get(opt.replace('-', '_')) if opt != 'reply-to': showaddr = '%s:' % opt.capitalize() else: showaddr = 'Reply-To:' if addrs: showaddrs.append('%s %s' % (showaddr, ', '.join(addrs))) return mail.addrlistencode(ui, addrs, _charsets, opts.get('test')) addrs = ui.config('email', opt) or ui.config('patchbomb', opt) or '' if not addrs and prpt: addrs = prompt(ui, prpt, default) if addrs: showaddrs.append('%s %s' % (showaddr, addrs)) return mail.addrlistencode(ui, [addrs], _charsets, opts.get('test'))