#!/bin/bash
function _net {
	COMPREPLY=();
	local cur prev;
	_get_comp_words_by_ref -n : cur prev;
	_expand || return 0;

	case $prev in 
		_a_dummy_)
			COMPREPLY=($(compgen -W '' -- ))
			return 0
			;;
		cache)
			COMPREPLY=($(compgen -W 'add del flush get list search stabilize' -- ))
			return 0
			;;
		conf)
			COMPREPLY=($(compgen -W 'addshare delincludes delparm delshare drop getincludes getparm import list listshares setincludes setparm showshare' -- ))
			return 0
			;;
		dom)
			COMPREPLY=($(compgen -W 'join renamecomputer unjoin' -- ))
			return 0
			;;
		eventlog)
			COMPREPLY=($(compgen -W 'dump export import' -- ))
			return 0
			;;
		g_lock)
			COMPREPLY=($(compgen -W 'do dump locks' -- ))
			return 0
			;;
		groupmap)
			COMPREPLY=($(compgen -W 'add addmem cleanup delete delmem list listmem memberships modify set ' -- ))
			return 0
			;;
		groupmember)
			COMPREPLY=($(compgen -W 'add delete list' -- ))
			return 0
			;;
		idmap)
			COMPREPLY=($(compgen -W 'aclmapset delete dump restore secret setmap' -- ))
			return 0
			;;
		registry)
			COMPREPLY=($(compgen -W 'createkey deletekey deletevalue enumerate getsd getvalue getvalueraw setvalue' --))
			return 0
			;;
		rpc)
			COMPREPLY=($(compgen -W 'audit info join oldjoin testjoin user password group share file printer changetrustpw trustdom abortshutdown shutdown samdump vampire getsid rights service registry shell' -- ))
			return 0
			;;
		rap)
			COMPREPLY=($(compgen -W 'admin domain file group groupmember password printq server session share user validate ' -- ))
			return 0
			;;
		sam)
			COMPREPLY=($(compgen -W 'addmem createbuiltingroup createdomaingroup createlocalgroup deletedomaingroup deletelocalgroup delmem list listmem mapunixgroup policy rights set show unmapunixgroup' -- ))
			return 0
			;;
		server)
			COMPREPLY=($(compgen -W 'domain name' -- ))
			return 0
			;;
		share)
			COMPREPLY=($(compgen -W 'add allowed delete list migrate users' -- ))
			return 0
			;;
		status)
			COMPREPLY=($(compgen -W 'sessions shares' -- ))
			return 0
			;;
		*)
	esac;
	case $cur in 
		*)
			COMPREPLY=($(compgen -W 'admin ads cache changesecretpw changetrustpw conf dom domain eventlog file getauthuser getdomainsid getlocalsid g_lock group groupmap groupmember help idmap join lookup maxrid password printq rap registry rpc sam server service session setauthuser setdomainsid setlocalsid share status time user usershare usersidlist validate' -- "$cur" ))
			return 0
			;;
	esac;
	return 0
}
complete -F _net -o nospace net

# Local variables:
# mode shell-script
# sh-basic-offset: 2
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex ts=2 sw=2 filetype=bash
