SCOLS_FL_ASCII = (1 << 2),
SCOLS_FL_NOHEADINGS = (1 << 3),
SCOLS_FL_EXPORT = (1 << 4),
+ SCOLS_FL_MAX = (1 << 5),
/*
* Column flags
*/
- SCOLS_FL_TRUNC = (1 << 5), /* truncate fields data if necessary */
- SCOLS_FL_TREE = (1 << 6), /* use tree "ascii art" */
- SCOLS_FL_RIGHT = (1 << 7), /* align to the right */
- SCOLS_FL_STRICTWIDTH = (1 << 8), /* don't reduce width if column is empty */
- SCOLS_FL_NOEXTREMES = (1 << 9), /* ignore extreme fields when count column width*/
+ SCOLS_FL_TRUNC = (1 << 15), /* truncate fields data if necessary */
+ SCOLS_FL_TREE = (1 << 16), /* use tree "ascii art" */
+ SCOLS_FL_RIGHT = (1 << 17), /* align to the right */
+ SCOLS_FL_STRICTWIDTH = (1 << 18), /* don't reduce width if column is empty */
+ SCOLS_FL_NOEXTREMES = (1 << 19), /* ignore extreme fields when count column width*/
};
extern struct libscols_iter *scols_new_iter(int direction);
}
width = cl->width;
- if (is_last_column(tb, cl) && len < width)
+ if (is_last_column(tb, cl) && len < width && !(tb->flags & SCOLS_FL_MAX))
width = len;
/* truncate data */
break;
}
}
- if (width < tb->termwidth) {
- /* enalarge the last column */
+
+ if (width < tb->termwidth && (tb->flags & SCOLS_FL_MAX)) {
+ /* try enlarge all columns */
+ while (width < tb->termwidth) {
+ scols_reset_iter(&itr, SCOLS_ITER_FORWARD);
+ while (scols_table_next_column(tb, &itr, &cl) == 0) {
+ cl->width++;
+ width++;
+ if (width == tb->termwidth)
+ break;
+ }
+ }
+ } else if (width < tb->termwidth) {
+ /* enlarge the last column */
struct libscols_column *cl = list_entry(
tb->tb_columns.prev, struct libscols_column, cl_columns);
int flags = 0, notree = 0, clone = 0, i, color = 0;
if (argc == 2 && !strcmp(argv[1], "--help")) {
- printf("%s [--ascii | --raw | --list | --clone | --clonetree]\n",
+ printf("%s [--max | --ascii | --raw | --export | --list | "
+ "--color | --colortree | --clone | --clonetree]\n",
program_invocation_short_name);
return EXIT_SUCCESS;
+ } else if (argc == 2 && !strcmp(argv[1], "--max")) {
+ flags |= SCOLS_FL_MAX;
} else if (argc == 2 && !strcmp(argv[1], "--ascii")) {
flags |= SCOLS_FL_ASCII;
} else if (argc == 2 && !strcmp(argv[1], "--raw")) {