Skip to content

Commit

Permalink
Tweak colors
Browse files Browse the repository at this point in the history
  • Loading branch information
sdispater committed Mar 27, 2020
1 parent 1aee3d2 commit b0bfab9
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion poetry/console/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def handle(self):
return 0

self.line(
" - Installing <c1>{}</c1> (<b>{}</b>)".format(
" - Installing <c1>{}</c1> (<c2>{}</c2>)".format(
self.poetry.package.pretty_name, self.poetry.package.pretty_version
)
)
Expand Down
5 changes: 3 additions & 2 deletions poetry/console/config/application_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ def configure(self):
super(ApplicationConfig, self).configure()

self.add_style(Style("c1").fg("cyan"))
self.add_style(Style("c2").fg("green"))
self.add_style(Style("info").fg("blue"))
self.add_style(Style("comment").fg("green"))
self.add_style(Style("error").fg("red").bold())
self.add_style(Style("warning").fg("yellow"))
self.add_style(Style("debug").fg("black").bold())
self.add_style(Style("warning").fg("yellow").bold())
self.add_style(Style("debug").fg("default").dark())

self.add_event_listener(PRE_HANDLE, self.register_command_loggers)
self.add_event_listener(PRE_HANDLE, self.set_env)
Expand Down
12 changes: 6 additions & 6 deletions poetry/installation/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def _execute_install(self, operation): # type: (Install) -> None
if operation.skipped:
if self.is_verbose() and (self._execute_operations or self.is_dry_run()):
self._io.write_line(
" - Skipping <c1>{}</c1> (<b>{}</b>) {}".format(
" - Skipping <c1>{}</c1> (<c2>{}</c2>) {}".format(
operation.package.pretty_name,
operation.package.full_pretty_version,
operation.skip_reason,
Expand All @@ -316,7 +316,7 @@ def _execute_install(self, operation): # type: (Install) -> None

if self._execute_operations or self.is_dry_run():
self._io.write_line(
" - Installing <c1>{}</c1> (<b>{}</b>)".format(
" - Installing <c1>{}</c1> (<c2>{}</c2>)".format(
operation.package.pretty_name, operation.package.full_pretty_version
)
)
Expand All @@ -333,7 +333,7 @@ def _execute_update(self, operation): # type: (Update) -> None
if operation.skipped:
if self.is_verbose() and (self._execute_operations or self.is_dry_run()):
self._io.write_line(
" - Skipping <c1>{}</c1> (<b>{}</b>) {}".format(
" - Skipping <c1>{}</c1> (<c2>{}</c2>) {}".format(
target.pretty_name,
target.full_pretty_version,
operation.skip_reason,
Expand All @@ -344,7 +344,7 @@ def _execute_update(self, operation): # type: (Update) -> None

if self._execute_operations or self.is_dry_run():
self._io.write_line(
" - Updating <c1>{}</c1> (<b>{}</b> -> <b>{}</b>)".format(
" - Updating <c1>{}</c1> (<c2>{}</c2> -> <c2>{}</c2>)".format(
target.pretty_name,
source.full_pretty_version,
target.full_pretty_version,
Expand All @@ -360,7 +360,7 @@ def _execute_uninstall(self, operation): # type: (Uninstall) -> None
if operation.skipped:
if self.is_verbose() and (self._execute_operations or self.is_dry_run()):
self._io.write_line(
" - Not removing <c1>{}</c1> (<b>{}</b>) {}".format(
" - Not removing <c1>{}</c1> (<c2>{}</c2>) {}".format(
operation.package.pretty_name,
operation.package.full_pretty_version,
operation.skip_reason,
Expand All @@ -371,7 +371,7 @@ def _execute_uninstall(self, operation): # type: (Uninstall) -> None

if self._execute_operations or self.is_dry_run():
self._io.write_line(
" - Removing <c1>{}</c1> (<b>{}</b>)".format(
" - Removing <c1>{}</c1> (<c2>{}</c2>)".format(
operation.package.pretty_name, operation.package.full_pretty_version
)
)
Expand Down
20 changes: 9 additions & 11 deletions poetry/puzzle/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,31 +731,31 @@ def debug(self, message, depth=0):

message = (
"<fg=blue>fact</>: <c1>{}</c1>{} "
"depends on <c1>{}</c1> (<b>{}</b>)".format(
"depends on <c1>{}</c1> (<c2>{}</c2>)".format(
name, version, m.group(2), m.group(3)
)
)
elif " is " in message:
message = re.sub(
"fact: (.+) is (.+)",
"<fg=blue>fact</>: <c1>\\1</c1> is <b>\\2</b>",
"<fg=blue>fact</>: <c1>\\1</c1> is <c2>\\2</c2>",
message,
)
else:
message = re.sub(
r"(?<=: )(.+?) \((.+?)\)", "<c1>\\1</c1> (<b>\\2</b>)", message
r"(?<=: )(.+?) \((.+?)\)", "<c1>\\1</c1> (<c2>\\2</c2>)", message
)
message = "<fg=blue>fact</>: {}".format(message.split("fact: ")[1])
elif message.startswith("selecting "):
message = re.sub(
r"selecting (.+?) \((.+?)\)",
"<fg=blue>selecting</> <c1>\\1</c1> (<b>\\2</b>)",
"<fg=blue>selecting</> <c1>\\1</c1> (<c2>\\2</c2>)",
message,
)
elif message.startswith("derived:"):
m = re.match(r"derived: (.+?) \((.+?)\)$", message)
if m:
message = "<fg=blue>derived</>: <c1>{}</c1> (<b>{}</b>)".format(
message = "<fg=blue>derived</>: <c1>{}</c1> (<c2>{}</c2>)".format(
m.group(1), m.group(2)
)
else:
Expand All @@ -768,14 +768,14 @@ def debug(self, message, depth=0):
m2 = re.match(r"(.+?) \((.+?)\)", m.group(1))
if m2:
name = m2.group(1)
version = " (<b>{}</b>)".format(m2.group(2))
version = " (<c2>{}</c2>)".format(m2.group(2))
else:
name = m.group(1)
version = ""

message = (
"<fg=red;options=bold>conflict</>: <c1>{}</c1>{} "
"depends on <c1>{}</c1> (<b>{}</b>)".format(
"depends on <c1>{}</c1> (<c2>{}</c2>)".format(
name, version, m.group(2), m.group(3)
)
)
Expand All @@ -791,7 +791,7 @@ def debug(self, message, depth=0):
debug_info = (
"\n".join(
[
"<comment>{}:</> {}".format(str(depth).rjust(4), s)
"<debug>{}:</debug> {}".format(str(depth).rjust(4), s)
for s in debug_info.split("\n")
]
)
Expand All @@ -806,9 +806,7 @@ def progress(self):
self._io.write_line("Resolving dependencies...")
yield
else:
indicator = Indicator(
self._io, "{message} <fg=black;options=bold>({elapsed:2s})</>"
)
indicator = Indicator(self._io, "{message} <debug>({elapsed:2s})</debug>")

with indicator.auto(
"<info>Resolving dependencies...</info>",
Expand Down
2 changes: 1 addition & 1 deletion poetry/repositories/pypi_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,4 +503,4 @@ def _download(self, url, dest): # type: (str, str) -> None
f.write(chunk)

def _log(self, msg, level="info"):
getattr(logger, level)("<comment>{}:</comment> {}".format(self._name, msg))
getattr(logger, level)("<debug>{}:</debug> {}".format(self._name, msg))

0 comments on commit b0bfab9

Please sign in to comment.