def show(self, file=None): if file is None: file = vistir.misc.get_text_stderr() if self.extra: if isinstance(self.extra, STRING_TYPES): self.extra = [self.extra] for extra in self.extra: click_echo(decode_for_output(extra, file), file=file) click_echo(self.message, file=file)
def show(self, file=None): if file is None: file = vistir.misc.get_text_stderr() if self.extra: if isinstance(self.extra, STRING_TYPES): self.extra = [self.extra] for extra in self.extra: extra = "[pipenv.exceptions.{!s}]: {}".format( self.__class__.__name__, extra) extra = decode_for_output(extra, file) click_echo(extra, file=file) click_echo(decode_for_output(f"{self.message}", file), file=file)
def show(self, file=None): if file is None: file = vistir.misc.get_text_stderr() message = "{}\n{}".format( crayons.normal("Failed parsing JSON results:", bold=True), decode_for_output(self.message.strip(), file)) click_echo(message, err=True) if self.error_text: click_echo("{} {}".format(crayons.normal("ERROR TEXT:", bold=True), decode_for_output(self.error_text, file)), err=True)
def handle_exception(exc_type, exception, traceback, hook=sys.excepthook): if environments.Setting().is_verbose() or not issubclass(exc_type, ClickException): hook(exc_type, exception, traceback) else: tb = format_tb(traceback, limit=-6) lines = itertools.chain.from_iterable([frame.splitlines() for frame in tb]) formatted_lines = [] for line in lines: line = line.strip("'").strip('"').strip("\n").strip() if not line.startswith("File"): line = f" {line}" else: line = f" {line}" line = "[{!s}]: {}".format(exception.__class__.__name__, line) formatted_lines.append(line) # use new exception prettification rules to format exceptions according to # UX rules click_echo(decode_for_output(prettify_exc("\n".join(formatted_lines))), err=True) exception.show()
def show(self, file=None): if file is None: file = vistir.misc.get_text_stderr() click.echo( "{} {}".format( click.style("Error running command: ", fg="red"), click.style(f"$ {self.cmd}", bold=True), ), err=True, file=file, ) if self.out: click.echo( "{} {}".format("OUTPUT: ", self.out), file=file, err=True, ) if self.err: click_echo( "{} {}".format("STDERR: ", self.err), file=file, err=True, )
def show(self, file=None): if file is None: file = vistir.misc.get_text_stderr() click_echo("{} {}".format( crayons.red("Error running command: "), crayons.normal(decode_for_output(f"$ {self.cmd}", file), bold=True)), err=True) if self.out: click_echo("{} {}".format(crayons.normal("OUTPUT: "), decode_for_output(self.out, file)), err=True) if self.err: click_echo("{} {}".format(crayons.normal("STDERR: "), decode_for_output(self.err, file)), err=True)
def show(self, file=None): if file is None: file = vistir.misc.get_text_stderr() color = None if self.ctx is not None: color = self.ctx.color if self.extra: if isinstance(self.extra, STRING_TYPES): self.extra = [self.extra] for extra in self.extra: if color: extra = getattr(crayons, color, "blue")(extra) click_echo(decode_for_output(extra, file), file=file) hint = '' if self.cmd is not None and self.cmd.get_help_option(self.ctx) is not None: hint = ('Try "%s %s" for help.\n' % (self.ctx.command_path, self.ctx.help_option_names[0])) if self.ctx is not None: click_echo(self.ctx.get_usage() + '\n%s' % hint, file=file, color=color) click_echo(self.message, file=file)