@domain_group.command(context_settings=CONTEXT_SETTINGS)
@click.option('--getlist', '-l', is_flag=True, help='list all actions', is_eager=True)
@click.option('--create', '-c', is_flag=True, help='create new domain', is_eager=True)
@click.option('--name', '-n', type=str, help='domain name entry', metavar='<example.com>')
@click.option('--ip', '-i', type=str, help='ip address for domain', metavar='<1.2.3.4>')
@click.option('--detail', '-d', type=str, help='get details of existing domain name', metavar='<example.com>')
@click.option('--delete', '-r', type=str, help='delete existing domain name', metavar='<example.com>')
@click.option('--token', '-t', type=str, help='digital ocean authentication token', metavar='<token>')
@click.option('--tablefmt', '-f', type=click.Choice(['fancy_grid', 'simple', 'plain', 'grid', 'pipe', 'orgtbl', 'psql', 'rst', 'mediawiki', 'html', 'latex', 'latex_booktabs', 'tsv']), help='output table format', default='fancy_grid', metavar='<format>')
@click.option('--proxy', '-p', help='proxy url to be used for this call', metavar='<http://ip:port>')
@click.pass_context
def domain(ctx, token, tablefmt, proxy, getlist, create, name, ip, detail, delete):
	if (not ctx.params['getlist'] and not ctx.params['create'] 
		and not ctx.params['name'] and not ctx.params['ip'] 
		and not ctx.params['detail'] and not ctx.params['delete']):
		return click.echo(ctx.get_help())

	option_list = ['getlist', 'create', 'detail', 'delete']

	if validate(ctx.params, option_list):
		if getlist:
			method = 'GET'
			url = DOMAIN_LIST
			result = DigitalOcean.do_request(method, url, token=token, proxy=proxy)
			if result['has_error']:
				click.echo()
				click.echo('Error: %s' %(result['error_message']))
			else:
				record = 'domain'
				headers = ['Domain Name']
				table = []
				for domain in result['domains']:
					table.append([domain['name']])
				data = {'headers': headers, 'table_data': table}
				print_table(tablefmt, data, record)

		if create:
			method = 'POST'
			url = DOMAIN_LIST
			params = {'name': name, 'ip_address': ip}
			result = DigitalOcean.do_request(method, url, token=token, proxy=proxy, params=params)
			if result['has_error']:
				click.echo()
				click.echo('Error: %s' %(result['error_message']))
			else:
				click.echo()
				click.echo("Domain Created ", name)
				click.echo()

		if detail:
			method = 'GET'
			url = DOMAIN_LIST + detail
			result = DigitalOcean.do_request(method, url, token=token, proxy=proxy)
			if result['has_error']:
				click.echo()
				click.echo('Error: %s' %(result['error_message']))
			else:
				click.echo()
				click.echo("name: %s" %(result['domain']['name']))
				click.echo("ttl: %s" %(result['domain']['ttl']))
				click.echo("zone file: %s" %(result['domain']['zone_file']))

		if delete:
			method = 'DELETE'
			url = DOMAIN_LIST + delete
			result = DigitalOcean.do_request(method, url, token=token, proxy=proxy)
			if result['has_error']:
				click.echo()
				click.echo('Error: %s' %(result['error_message']))
			else:
				click.echo()
				click.echo("Domain %s deleted" %(delete))
Domains that you are managing through the DigitalOcean DNS interface.
dataset/ETHPy150Open yspanchal/docli/docli/commands/domain.py/domain