@@ -108,48 +108,54 @@ pub fn list_languages(config: &Config) -> Result<()> {
108 .collect::<Vec<_>>();
108 .collect::<Vec<_>>();
109 languages.sort_by_key(|lang| lang.name.to_uppercase());
109 languages.sort_by_key(|lang| lang.name.to_uppercase());
111− let longest = languages
113− .map(|syntax| syntax.name.len())
115− .unwrap_or(32); // Fallback width if they have no language definitions.
117− let comma_separator = ", ";
118− let separator = " ";
119− // Line-wrapping for the possible file extension overflow.
120− let desired_width = config.term_width - longest - separator.len();
122 let stdout = io::stdout();
111 let stdout = io::stdout();
123 let mut stdout = stdout.lock();
112 let mut stdout = stdout.lock();
125− let style = if config.colored_output {
114+ if config.loop_through {
126− Green.normal()
115+ for lang in languages {
116+ write!(stdout, "{}:{}\n", lang.name, lang.file_extensions.join(","));
119+ let longest = languages
121+ .map(|syntax| syntax.name.len())
123+ .unwrap_or(32); // Fallback width if they have no language definitions.
125+ let comma_separator = ", ";
126+ let separator = " ";
127+ // Line-wrapping for the possible file extension overflow.
128+ let desired_width = config.term_width - longest - separator.len();
130+ let style = if config.colored_output {
128− Style::default()
133+ Style::default()
131− for lang in languages {
132− write!(stdout, "{:width$}{}", lang.name, separator, width = longest)?;
134− // Number of characters on this line so far, wrap before `desired_width`
135− let mut num_chars = 0;
137− let mut extension = lang.file_extensions.iter().peekable();
138− while let Some(word) = extension.next() {
139− // If we can't fit this word in, then create a line break and align it in.
140− let new_chars = word.len() + comma_separator.len();
141− if num_chars + new_chars >= desired_width {
143− write!(stdout, "\n{:width$}{}", "", separator, width = longest)?;
136+ for lang in languages {
137+ write!(stdout, "{:width$}{}", lang.name, separator, width = longest)?;
139+ // Number of characters on this line so far, wrap before `desired_width`
140+ let mut num_chars = 0;
142+ let mut extension = lang.file_extensions.iter().peekable();
143+ while let Some(word) = extension.next() {
144+ // If we can't fit this word in, then create a line break and align it in.
145+ let new_chars = word.len() + comma_separator.len();
146+ if num_chars + new_chars >= desired_width {
148+ write!(stdout, "\n{:width$}{}", "", separator, width = longest)?;
146− num_chars += new_chars;
151+ num_chars += new_chars;
147− write!(stdout, "{}", style.paint(&word[..]))?;
152+ write!(stdout, "{}", style.paint(&word[..]))?;
148− if extension.peek().is_some() {
153+ if extension.peek().is_some() {
149− write!(stdout, "{}", comma_separator)?;
154+ write!(stdout, "{}", comma_separator)?;