def wrap_script(self) -> None:
        '''convert action: script to task: action(script)'''
        if self._action is None:
            return
        # _action options can contain both runtime option and action options
        opt = self._action_options.strip()
        if self.statements[-1][0] != ':' or self.statements[-1][
                1] != '__script__':
            raise RuntimeError('Failed to parse script')
        # under window, the lines will be ended with \r\n, which will cause
        # trouble with textwrap.dedent.
        self._script = '\n'.join(self._script.splitlines()) + '\n'
        # dedent, which will not remove empty line, so _scrit will always ends with \n.
        self._script = textwrap.dedent(self._script)
        # let us look for 'expand=""' in options
        if 'expand' in opt:
            sigil, opt = extract_option_from_arg_list(opt, 'expand', None)
            if sigil is None or sigil is False:
                # no expansion
                self._script = repr(self._script)
            elif sigil is True:
                self._script = as_fstring(self._script)
            else:
                self._script = as_fstring(replace_sigil(self._script, sigil))
        else:
            # verbatim script, use repr is enough
            self._script = repr(self._script)
        self.statements[-1] = [
            '!',
            f'{self._action}({self._script}{(", " + opt) if opt else ""})\n'
        ]
        self.values = []
        self._action = None
        self._action_options = None
        self._script = ''
convert action: script to task: action(script)