Skip to content

Commit ddca9a6

Browse files
committed
fix: align error messages with original distrobox format
- Use ERROR: prefix (uppercase) for critical errors matching original - Change "Failed to create container" to lowercase "failed to create" - Change "Container Setup Failure!" to "Error: could not start entrypoint" - Change "Unknown command" to "invalid command" - Change "Invalid container manager" to "Invalid input" format - Remove [error] tags in upgrade message, use red() directly
1 parent 0649d2e commit ddca9a6

5 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/distrobox_plus/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def _main(argv: list[str] | None = None) -> int:
121121
return run(args)
122122

123123
case _:
124-
print_error(red(f"Error: Unknown command '{command}'"))
124+
print_error(red("Error: invalid command"))
125125
parser.print_help(sys.stderr)
126126
return 1
127127

src/distrobox_plus/commands/create.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -780,9 +780,9 @@ def _resolve_hostname(
780780

781781
if not validate_hostname(hostname):
782782
print_error(
783-
f"[error]Error: Invalid hostname '{hostname}', longer than 64 characters[/error]"
783+
f"[error]ERROR: Invalid hostname '{hostname}', longer than 64 characters[/error]"
784784
)
785-
print_error("Use --hostname argument to set it manually")
785+
print_error("ERROR: Use --hostname argument to set it manually")
786786
return None
787787

788788
return hostname
@@ -869,7 +869,7 @@ def _handle_clone(
869869
Clone image name if successful, None if failed
870870
"""
871871
if not manager.is_podman and not manager.is_docker:
872-
print_error("[error]Error: clone is only supported with docker and podman[/error]")
872+
print_error("[error]ERROR: clone is only supported with docker and podman[/error]")
873873
return None
874874
return get_clone_image(manager, opts.clone)
875875

@@ -946,7 +946,7 @@ def _execute_create(
946946
return 0
947947
else:
948948
print_error(red("[ ERR ]"))
949-
print_error(red("Failed to create container."))
949+
print_error(red("failed to create container."))
950950
if result.stderr:
951951
print_error(result.stderr)
952952
return result.returncode

src/distrobox_plus/commands/enter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def wait_for_container_setup(
226226
# Check container is still running
227227
status = manager.get_status(container_name)
228228
if status != "running":
229-
print_error(f"\n{red('Container Setup Failure!')}")
229+
print_error(f"\n{red('Error: could not start entrypoint.')}")
230230
return False
231231

232232
# Start logs process

src/distrobox_plus/commands/upgrade.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def _upgrade_container(
142142
Exit code
143143
"""
144144
# Print upgrade message in red bold like original (rich handles TTY detection)
145-
print_error(f"[error] Upgrading {container}...[/error]")
145+
print_error(red(f" Upgrading {container}..."))
146146

147147
# Build the upgrade command
148148
# Original: command -v su-exec && su-exec root /usr/bin/entrypoint --upgrade ||

src/distrobox_plus/container.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,8 @@ def detect_container_manager(
461461
if preferred and preferred != "autodetect":
462462
if preferred not in SUPPORTED_MANAGERS:
463463
raise InvalidContainerManagerError(
464-
f"Invalid container manager: {preferred}\n"
465-
f"Available choices: 'autodetect', {', '.join(repr(m) for m in SUPPORTED_MANAGERS)}"
464+
f"Invalid input {preferred}.\n"
465+
f"The available choices are: 'autodetect', {', '.join(repr(m) for m in SUPPORTED_MANAGERS)}"
466466
)
467467

468468
path = shutil.which(preferred)

0 commit comments

Comments
 (0)