Skip to content

Commit c457d7e

Browse files
committed
Merge branch 'feature/non-interactive-mode'
2 parents c86cc95 + e446580 commit c457d7e

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/mcpm/commands/install.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from mcpm.profile.profile_config import ProfileConfigManager
2121
from mcpm.schemas.full_server_config import FullServerConfig
2222
from mcpm.utils.config import NODE_EXECUTABLES, ConfigManager
23-
from mcpm.utils.non_interactive import should_force_operation, is_non_interactive
23+
from mcpm.utils.non_interactive import should_force_operation
2424
from mcpm.utils.repository import RepositoryManager
2525
from mcpm.utils.rich_click_config import click
2626

@@ -73,14 +73,15 @@ def global_add_server(server_config: ServerConfig, force: bool = False) -> bool:
7373
return global_config_manager.add_server(server_config, force)
7474

7575

76-
def prompt_with_default(prompt_text, default="", hide_input=False, required=False):
76+
def prompt_with_default(prompt_text, default="", hide_input=False, required=False, force=False):
7777
"""Prompt the user with a default value that can be edited directly.
7878
7979
Args:
8080
prompt_text: The prompt text to display
8181
default: The default value to show in the prompt
8282
hide_input: Whether to hide the input (for passwords)
8383
required: Whether this is a required field
84+
force: Whether to force non-interactive mode
8485
8586
Returns:
8687
The user's input or the default value if empty
@@ -89,7 +90,7 @@ def prompt_with_default(prompt_text, default="", hide_input=False, required=Fals
8990
# We do NOT check is_non_interactive() here because it includes isatty(),
9091
# which returns True in tests (CliRunner), causing us to skip mocked prompts.
9192
# Users desiring non-interactive behavior must set MCPM_NON_INTERACTIVE=true.
92-
if os.getenv("MCPM_NON_INTERACTIVE", "").lower() == "true" or should_force_operation():
93+
if os.getenv("MCPM_NON_INTERACTIVE", "").lower() == "true" or should_force_operation(force):
9394
if default:
9495
return default
9596
if required:
@@ -152,7 +153,8 @@ def install(server_name, force=False, alias=None):
152153
config_name = alias or server_name
153154

154155
# All servers are installed to global configuration
155-
console.print("[yellow]Installing server to global configuration...[/]")
156+
console_stderr = Console(stderr=True)
157+
console_stderr.print("[yellow]Installing server to global configuration...[/]")
156158

157159
# Get server metadata from repository
158160
server_metadata = repo_manager.get_server_metadata(server_name)

0 commit comments

Comments
 (0)