Skip to content

Commit

Permalink
Improve terminal logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek committed Oct 8, 2023
1 parent 6a1f8dc commit c592d5f
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 19 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/docs-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ on:
concurrency:
group: docs-deploy

env:
FORCE_COLOR: "1"

jobs:
build:
runs-on: ubuntu-latest
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/docs-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ on:
concurrency:
group: docs-deploy

env:
FORCE_COLOR: "1"

jobs:
build:
runs-on: ubuntu-latest
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ concurrency:
env:
STABLE_PYTHON_VERSION: '3.11'
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"

jobs:
run:
Expand Down
10 changes: 0 additions & 10 deletions src/hatch/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from hatch.cli.version import version
from hatch.config.constants import AppEnvVars, ConfigEnvVars
from hatch.project.core import Project
from hatch.utils.ci import running_in_ci
from hatch.utils.fs import Path


Expand Down Expand Up @@ -96,15 +95,6 @@ def hatch(ctx: click.Context, env_name, project, verbose, quiet, color, interact
| | | | (_| | || (__| | | |
\\_| |_/\\__,_|\\__\\___|_| |_|
"""
if color is None:
if os.environ.get(AppEnvVars.NO_COLOR) == '1':
color = False
elif os.environ.get(AppEnvVars.FORCE_COLOR) == '1':
color = True

if interactive is None:
interactive = not running_in_ci()

app = Application(ctx.exit, verbose - quiet, color, interactive)

app.env_active = os.environ.get(AppEnvVars.ENV_ACTIVE)
Expand Down
4 changes: 2 additions & 2 deletions src/hatch/cli/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ def __init__(self, verbosity, enable_color, interactive):
self.verbosity = verbosity
self.interactive = interactive
self.console = Console(
force_terminal=enable_color,
no_color=enable_color is False,
force_interactive=interactive,
no_color=enable_color,
markup=False,
emoji=False,
highlight=False,
Expand Down

0 comments on commit c592d5f

Please sign in to comment.