'Change active host/group. You can use hosts patterns as well eg.:
cd webservers
cd webservers:dbservers
cd webservers:!phoenix
cd webservers:&staging
cd webservers:dbservers:&staging:!phoenix'

def do_cd(self, arg):

    if (not arg):
        self.options.cwd = '*'
    elif (arg in '/*'):
        self.options.cwd = 'all'
    elif self.inventory.get_hosts(arg):
        self.options.cwd = arg
    else:
        display.display('no    host    matched')
    self.set_prompt()
