fn write_args(&mut self, args: &[&Arg<'b>]) -> io::Result<()> {
        debug!("Help::write_args");
        // The shortest an arg can legally be is 2 (i.e. '-x')
        self.longest = 2;
        let mut ord_m = VecMap::new();
        let use_long = self.use_long;
        // Determine the longest
        for arg in args.iter().filter(|arg| {
            // If it's NextLineHelp we don't care to compute how long it is because it may be
            // NextLineHelp on purpose simply *because* it's so long and would throw off all other
            // args alignment
            should_show_arg(use_long, *arg)
        }) {
            if arg.longest_filter() {
                debug!("Help::write_args: Current Longest...{}", self.longest);
                self.longest = cmp::max(self.longest, str_width(arg.to_string().as_str()));
                debug!("Help::write_args: New Longest...{}", self.longest);
            }
            let btm = ord_m.entry(arg.disp_ord).or_insert(BTreeMap::new());
            // We use name here for alphabetic sorting
            // @TODO @maybe perhaps we could do some sort of ordering off of keys?
            btm.insert(arg.name, arg);
        }
        let mut first = true;
        for btm in ord_m.values() {
            for arg in btm.values() {
                if first {
                    first = false;
                } else {
                    self.none("\n")?;
                }
                self.write_arg(arg, false)?;
            }
        }
        Ok(())
    }
/// Sorts arguments by length and display order and write their help to the wrapped stream.
Sorts arguments by length and display order and write their help to the wrapped stream.
Sorts arguments by length and display order and write their help to the wrapped stream .
fn write_args(&mut self, args: &[&Arg<'b>]) -> io::Result<()> {
        debug!("Help::write_args");
        // The shortest an arg can legally be is 2 (i.e. '-x')
        self.longest = 2;
        let mut ord_m = VecMap::new();
        let use_long = self.use_long;
        // Determine the longest
        for arg in args.iter().filter(|arg| {
            // If it's NextLineHelp we don't care to compute how long it is because it may be
            // NextLineHelp on purpose simply *because* it's so long and would throw off all other
            // args alignment
            should_show_arg(use_long, *arg)
        }) {
            if arg.longest_filter() {
                debug!("Help::write_args: Current Longest...{}", self.longest);
                self.longest = cmp::max(self.longest, str_width(arg.to_string().as_str()));
                debug!("Help::write_args: New Longest...{}", self.longest);
            }
            let btm = ord_m.entry(arg.disp_ord).or_insert(BTreeMap::new());
            // We use name here for alphabetic sorting
            // @TODO @maybe perhaps we could do some sort of ordering off of keys?
            btm.insert(arg.name, arg);
        }
        let mut first = true;
        for btm in ord_m.values() {
            for arg in btm.values() {
                if first {
                    first = false;
                } else {
                    self.none("\n")?;
                }
                self.write_arg(arg, false)?;
            }
        }
        Ok(())
    }
fn write_args ( & mut self , args : & [ & Arg < ' b > ] ) -> io :: Result < ( ) > { debug ! ( " " ) ; // The shortest an arg can legally be is 2 (i.e. '-x') self . longest = 2 ; let mut ord_m = VecMap :: new ( ) ; let use_long = self . use_long ; // Determine the longest for arg in args . iter ( ) . filter ( | arg | { // If it's NextLineHelp we don't care to compute how long it is because it may be // NextLineHelp on purpose simply *because* it's so long and would throw off all other // args alignment should_show_arg ( use_long , * arg ) } ) { if arg . longest_filter ( ) { debug ! ( " " self longest ) ; self . longest = cmp :: max ( self . longest , str_width ( arg . to_string ( ) . as_str ( ) ) ) ; debug ! ( " " self longest ) ; } let btm = ord_m . entry ( arg . disp_ord ) . or_insert ( BTreeMap :: new ( ) ) ; // We use name here for alphabetic sorting // @TODO @maybe perhaps we could do some sort of ordering off of keys? btm . insert ( arg . name , arg ) ; } let mut first = true ; for btm in ord_m . values ( ) { for arg in btm . values ( ) { if first { first = false ; } else { self . none ( " \n " ) ? ; } self . write_arg ( arg , false ) ? ; } } Ok ( ( ) ) }
Sorts arguments by length and display order and write their help to the wrapped stream.
Sorts arguments by length and display order and write their help to the wrapped stream .
&mut self
args
&[&Arg<'b>]
&mut self
args
&[&Arg<'b>]