• 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 homu-tmp
branch: homu-tmp
CHANGE BRANCH
x
Reset
  • homu-tmp
  • auto
  • master
  • v3-master

pending completion
3093

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

11 of 11 new or added lines in 2 files covered. (100.0%)

7647 of 8585 relevant lines covered (89.07%)

4.04 hits per line

Relevant lines Covered
Build:
Build:
8585 RELEVANT LINES 7647 COVERED LINES
4.04 HITS PER LINE
Source Files on homu-tmp
  • List 0
  • Changed 55
  • Source Changed 0
  • Coverage Changed 55
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
3093 homu-tmp 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:18AM UTC homu travis-ci pending completion  
3083 homu-tmp Auto merge of #830 - kbknapp:issue-826, r=kbknapp Issue 826 push 30 Jan 2017 04:59AM UTC homu travis-ci pending completion  
3072 homu-tmp Auto merge of #821 - SuperFluffy:fix_argroup_doc, r=kbknapp Fix confusing, wrong wording in doc push 30 Jan 2017 02:20AM UTC homu travis-ci pending completion  
3052 homu-tmp 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:29AM UTC homu travis-ci pending completion  
3047 homu-tmp 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 01:55AM UTC homu travis-ci pending completion  
3034 homu-tmp Auto merge of #813 - pixelistik:patch-1, r=kbknapp doc: Fix typo push 09 Jan 2017 02:24AM UTC homu travis-ci pending completion  
3030 homu-tmp Auto merge of #811 - Seeker14491:master, r=kbknapp docs: fix spelling of "guaranteed" push 08 Jan 2017 03:31AM UTC homu travis-ci pending completion  
3026 homu-tmp Auto merge of #809 - kbknapp:issue-636, r=kbknapp Issue 636 push 06 Jan 2017 02:08AM UTC homu travis-ci pending completion  
3015 homu-tmp Auto merge of #804 - kbknapp:issues-801,694, r=kbknapp Issues 801,694 and tests overhaul push 03 Jan 2017 06:25AM UTC homu travis-ci pending completion  
3008 homu-tmp Auto merge of #802 - kbknapp:issues-774,777, r=kbknapp Issues 774,777 push 03 Jan 2017 12:47AM 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

© 2025 Coveralls, Inc