From 8f9c34668f52fd83097555a793007063be767f82 Mon Sep 17 00:00:00 2001 From: Jay Oster Date: Wed, 12 Apr 2023 18:29:58 -0700 Subject: [PATCH] Fix padding on `#[long]` args in help text. (#7) --- onlyargs_derive/src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/onlyargs_derive/src/lib.rs b/onlyargs_derive/src/lib.rs index 0511ece..7d1acf6 100644 --- a/onlyargs_derive/src/lib.rs +++ b/onlyargs_derive/src/lib.rs @@ -413,12 +413,13 @@ fn to_help(view: ArgView, max_width: usize) -> String { let pad = " ".repeat(max_width + LONG_PAD); let help = view.doc.join(&format!("\n{pad}")); + let width = max_width - name.len(); if let Some(ch) = view.short { - let width = max_width - SHORT_PAD - name.len(); + let width = width - SHORT_PAD; format!(" -{ch} --{name}{ty: