MCPcopy Index your code
hub / github.com/git/git / print_columns

Function print_columns

column.c:182–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182void print_columns(const struct string_list *list, unsigned int colopts,
183 const struct column_options *opts)
184{
185 struct column_options nopts;
186
187 if (opts && (0 > opts->padding))
188 BUG("padding must be non-negative");
189 if (!list->nr)
190 return;
191 assert((colopts & COL_ENABLE_MASK) != COL_AUTO);
192
193 memset(&nopts, 0, sizeof(nopts));
194 nopts.indent = opts && opts->indent ? opts->indent : "";
195 nopts.nl = opts && opts->nl ? opts->nl : "\n";
196 nopts.padding = opts ? opts->padding : 1;
197 nopts.width = opts && opts->width ? opts->width : term_columns() - 1;
198 if (!column_active(colopts)) {
199 display_plain(list, "", "\n");
200 return;
201 }
202 switch (COL_LAYOUT(colopts)) {
203 case COL_PLAIN:
204 display_plain(list, nopts.indent, nopts.nl);
205 break;
206 case COL_ROW:
207 case COL_COLUMN:
208 display_table(list, colopts, &nopts);
209 break;
210 default:
211 BUG("invalid layout mode %d", COL_LAYOUT(colopts));
212 }
213}
214
215int finalize_colopts(unsigned int *colopts, int stdout_is_tty)
216{

Callers 6

pretty_print_cmdnamesFunction · 0.85
pretty_print_delsFunction · 0.85
pretty_print_menusFunction · 0.85
cmd_columnFunction · 0.85
cmd_branchFunction · 0.85

Calls 4

term_columnsFunction · 0.85
column_activeFunction · 0.85
display_plainFunction · 0.85
display_tableFunction · 0.85

Tested by

no test coverage detected