From 66e420f34be72d47e1b84662f5a5792bd52c65e2 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Tue, 16 Apr 2024 13:54:40 +0100 Subject: [PATCH] Enable auto-wrapping of `--help` output (#3058) ## Summary Fixes #3057 On `main`, with a narrow terminal: -
![image](https://github.com/astral-sh/uv/assets/66076021/2453dcbc-739c-4174-ba2e-029cff3227a2)
-
![image](https://github.com/astral-sh/uv/assets/66076021/02553e90-fe35-4828-b50f-71f926a1e347)
-
![image](https://github.com/astral-sh/uv/assets/66076021/b33eac26-f2fe-4328-8aa0-c51235b7c4c3)
-
![image](https://github.com/astral-sh/uv/assets/66076021/e731f647-3519-4c54-ab33-b42500faf544)
With PR: -
![image](https://github.com/astral-sh/uv/assets/66076021/0f1aaec0-960a-4060-95ba-f49bec2f6995)
-
![image](https://github.com/astral-sh/uv/assets/66076021/b8078125-bd57-41a9-9c09-1966c8971c92)
-
![image](https://github.com/astral-sh/uv/assets/66076021/c2f38eb0-5f67-46ee-8a09-47da9e9ce0a5)
-
![image](https://github.com/astral-sh/uv/assets/66076021/31b9fdca-938a-47ca-96ba-751d987c269e)
## Test Plan See screenshots in the summary --- Cargo.lock | 1 + crates/uv-dev/Cargo.toml | 2 +- crates/uv/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 949f287e5..2217cd299 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -656,6 +656,7 @@ dependencies = [ "anstyle", "clap_lex", "strsim", + "terminal_size", ] [[package]] diff --git a/crates/uv-dev/Cargo.toml b/crates/uv-dev/Cargo.toml index 727e89e9f..6bab89234 100644 --- a/crates/uv-dev/Cargo.toml +++ b/crates/uv-dev/Cargo.toml @@ -39,7 +39,7 @@ uv-types = { workspace = true } anstream = { workspace = true } anyhow = { workspace = true } chrono = { workspace = true } -clap = { workspace = true, features = ["derive"] } +clap = { workspace = true, features = ["derive", "wrap_help"] } fs-err = { workspace = true, features = ["tokio"] } futures = { workspace = true } indicatif = { workspace = true } diff --git a/crates/uv/Cargo.toml b/crates/uv/Cargo.toml index e92718742..179fc1a92 100644 --- a/crates/uv/Cargo.toml +++ b/crates/uv/Cargo.toml @@ -41,7 +41,7 @@ anstream = { workspace = true } anyhow = { workspace = true } axoupdater = { workspace = true, features = ["github_releases", "tokio"], optional = true } chrono = { workspace = true } -clap = { workspace = true, features = ["derive", "string"] } +clap = { workspace = true, features = ["derive", "string", "wrap_help"] } clap_complete_command = { workspace = true } flate2 = { workspace = true, default-features = false } fs-err = { workspace = true, features = ["tokio"] }