• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kbknapp / clap-rs
89%
master: 94%

Build:
Build:
LAST BUILD BRANCH: issues-839,840
DEFAULT BRANCH: master
Repo Added 02 Sep 2015 06:51PM UTC
Files 63
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

LAST BUILD ON BRANCH auto
branch: auto
CHANGE BRANCH
x
Reset
  • auto
  • homu-tmp
  • master
  • v3-master

pending completion
3094

push

travis-ci

homu
Auto merge of #832 - mgeisler:fix-wrapping-bugs, r=kbknapp

Fix wrapping bugs

I've been working towards integrating my [textwrap][1] crate and along the way, I found some small problems in the existing `wrap_help` function in clap. I basically added new code that calls both `textwrap::fill` and `wrap_help` and panicked on any difference:
```
fn wrap_help(help: &mut String, longest_w: usize, avail_chars: usize) {
    let input = help.clone();
    let mut old = help.clone();
    old_wrap_help(&mut old, longest_w, avail_chars);

    let mut wrapped = String::with_capacity(help.len());
    for (i, line) in help.lines().enumerate() {
        if i > 0 {
            wrapped.push('\n');
        }
        wrapped.push_str(&textwrap::fill(line, avail_chars));
    }

    // TODO: move up, This keeps old behavior of not wrapping at all
    // if one of the words would overflow the line
    if longest_w < avail_chars {
        *help = wrapped;
    }

    if *old != *help {
        println!("********************************");
        println!("longest_w: {}, avail_chars: {}", longest_w, avail_chars);
        println!("help: {:3} bytes: {:?}", input.len(), input);
        println!("old:  {:3} bytes: {:?}", old.len(), old);
        println!("new:  {:3} bytes: {:?}", help.len(), help);
        println!("********************************");
        panic!("bad wrap");
    }
}

fn old_wrap_help(help: &mut String, longest_w: usize, avail_chars: usize) {
    // ... as before
```

This PR fixes two small problems discovered this way, one of which became #828.

[1]: https://crates.io/crates/textwrap

7647 of 8585 relevant lines covered (89.07%)

3.21 hits per line

Relevant lines Covered
Build:
Build:
8585 RELEVANT LINES 7647 COVERED LINES
3.21 HITS PER LINE
Source Files on auto
Detailed source file information is not available for this build.

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
3094 auto Auto merge of #832 - mgeisler:fix-wrapping-bugs, r=kbknapp Fix wrapping bugs I've been working towards integrating my [textwrap][1] crate and along the way, I found some small problems in the existing `wrap_help` function in clap. I basically ad... push 31 Jan 2017 12:50AM UTC homu travis-ci pending completion  
3084 auto Auto merge of #830 - kbknapp:issue-826, r=kbknapp Issue 826 push 30 Jan 2017 05:20AM UTC homu travis-ci pending completion  
3053 auto Auto merge of #820 - shepmaster:patch-1, r=kbknapp Add categories to Cargo.toml Hi! [crates.io now supports categories][categories], which are a curated list of topics aimed at helping an end-user coming to crates.io looking for "a crate to do _... push 21 Jan 2017 03:46AM UTC homu travis-ci pending completion  
3048 auto Auto merge of #819 - SuperFluffy:add_note_to_doc, r=kbknapp Explain how `ArgRequiredElseHelp` and `default_value` interact When calling the executable without arguments one expects a help message. However, if even one argument has a default valu... push 19 Jan 2017 02:13AM UTC homu travis-ci pending completion  
3035 auto Auto merge of #813 - pixelistik:patch-1, r=kbknapp doc: Fix typo push 09 Jan 2017 02:39AM UTC homu travis-ci pending completion  
3031 auto Auto merge of #811 - Seeker14491:master, r=kbknapp docs: fix spelling of "guaranteed" push 08 Jan 2017 03:48AM UTC homu travis-ci pending completion  
3016 auto Auto merge of #804 - kbknapp:issues-801,694, r=kbknapp Issues 801,694 and tests overhaul push 03 Jan 2017 06:38AM UTC homu travis-ci pending completion  
3009 auto Auto merge of #802 - kbknapp:issues-774,777, r=kbknapp Issues 774,777 push 03 Jan 2017 01:04AM UTC homu travis-ci pending completion  
2982 auto Auto merge of #797 - kbknapp:three-new-settings-and-a-fix, r=kbknapp Three new settings and a fix push 31 Dec 2016 06:01AM UTC homu travis-ci pending completion  
2977 auto Auto merge of #796 - kbknapp:issue-665, r=kbknapp Issue 665 push 30 Dec 2016 11:27PM UTC homu travis-ci pending completion  
See All Builds (1821)
  • Repo on GitHub
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc