diff options
| author | Marvin Löbel <loebel.marvin@gmail.com> | 2013-03-23 17:25:16 +0100 |
|---|---|---|
| committer | Marvin Löbel <loebel.marvin@gmail.com> | 2013-03-26 14:59:17 +0100 |
| commit | d74606ead60d524eb72afad2cd8b45facd6c5d40 (patch) | |
| tree | 55c4d07b5e67f9576fb496a0e24b67600504324e /src/libstd | |
| parent | 624a685283f66afcb40ee3c235624aedebc2f08f (diff) | |
| download | rust-d74606ead60d524eb72afad2cd8b45facd6c5d40.tar.gz rust-d74606ead60d524eb72afad2cd8b45facd6c5d40.zip | |
pre-rebase commit
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/getopts.rs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/libstd/getopts.rs b/src/libstd/getopts.rs index de8a8f34381..f837f776b96 100644 --- a/src/libstd/getopts.rs +++ b/src/libstd/getopts.rs @@ -601,7 +601,7 @@ pub mod groups { row += match short_name.len() { 0 => ~"", 1 => ~"-" + short_name + " ", - _ => fail!(~"the short name should only be 1 char long"), + _ => fail!(~"the short name should only be 1 ascii char long"), }; // long option @@ -617,6 +617,7 @@ pub mod groups { Maybe => ~"[" + hint + ~"]", }; + // FIXME: #5516 // here we just need to indent the start of the description let rowlen = row.len(); row += if rowlen < 24 { @@ -625,8 +626,22 @@ pub mod groups { desc_sep }; + // Normalize desc to contain words seperated by one space character + let mut desc_normalized_whitespace = ~str + for desc.each_word |word| { + desc_normalized_whitespace.push_str(word); + desc_normalized_whitespace.push_char(' '); + } + + // FIXME: #5516 + let mut desc_rows: ~[~str] = ~[]; + for desc_normalized_whitespace.each_split_within(54) |substr| { + desc_rows.push(~substr); + } + + // FIXME: #5516 // wrapped description - row += str::connect(str::split_within(desc, 54), desc_sep); + row += str::connect(desc_rows, desc_sep); row }); |
