Used by the :command:`salt` CLI. This method returns minion returns as
        they come back and attempts to block until all minions return.

        The function signature is the same as :py:meth:`cmd` with the
        following exceptions.

        :param verbose: Print extra information about the running command
        :returns: A generator

def cmd_cli(
            self,
            tgt,
            fun,
            arg=(),
            timeout=None,
            tgt_type='glob',
            ret='',
            verbose=False,
            kwarg=None,
            progress=False,
            **kwargs):
        '''
        Used by the :command:`salt` CLI. This method returns minion returns as
        they come back and attempts to block until all minions return.

        The function signature is the same as :py:meth:`cmd` with the
        following exceptions.

        :param verbose: Print extra information about the running command
        :returns: A generator
        '''
        was_listening = self.event.cpub

        if fun.startswith('state.'):
            ref = {'compound': '-C',
                    'glob': '',
                    'grain': '-G',
                    'grain_pcre': '-P',
                    'ipcidr': '-S',
                    'list': '-L',
                    'nodegroup': '-N',
                    'pcre': '-E',
                    'pillar': '-I',
                    'pillar_pcre': '-J'}
            if HAS_RANGE:
                ref['range'] = '-R'
            if ref[tgt_type].startswith('-'):
                self.target_data = "{0} '{1}'".format(
                    ref[tgt_type],
                    ','.join(tgt) if isinstance(tgt, list) else tgt)
            else:
                self.target_data = ','.join(tgt) if isinstance(tgt, list) else tgt
        else:
            self.target_data = ''

        try:
            self.pub_data = self.run_job(
                tgt,
                fun,
                arg,
                tgt_type,
                ret,
                timeout,
                kwarg=kwarg,
                listen=True,
                **kwargs)

            if not self.pub_data:
                yield self.pub_data
            else:
                try:
                    for fn_ret in self.get_cli_event_returns(
                            self.pub_data['jid'],
                            self.pub_data['minions'],
                            self._get_timeout(timeout),
                            tgt,
                            tgt_type,
                            verbose,
                            progress,
                            **kwargs):

                        if not fn_ret:
                            continue

                        yield fn_ret
                except KeyboardInterrupt:
                    exit_msg = (
                        '\nExiting gracefully on Ctrl-c'
                        '\n'
                        'This job\'s jid is: {0}\n'
                        'The minions may not have all finished running and any '
                        'remaining minions will return upon completion.\n\n'
                        'To look up the return data for this job later, run the '
                        'following command:\n'
                        'salt-run jobs.lookup_jid {0}'.format(self.pub_data['jid']))
                    if self.target_data:
                        exit_msg += (
                            '\n\n'
                            'To set up the state run to safely exit, run the following command:\n'
                            'salt {0} state.soft_kill {1}'.format(self.target_data, self.pub_data['jid']))
                    raise SystemExit(exit_msg)
        finally:
            if not was_listening:
                self.event.close_pub()