== OPTIONS
-The argument _columns_ for *--table-** options is a comma separated list of the column names as defined by *--table-columns* or it's column number in order as specified by input. It's possible to mix names and numbers.
+The argument _columns_ for *--table-** options is a comma separated list of the column names as defined by *--table-columns* or it's column number in order as specified by input. It's possible to mix names and numbers. The special placeholder '0' (e.g. -R0) may be used to specify all columns.
*-J, --json*::
Use JSON output format to print the table, the option *--table-columns* is required and the option *--table-name* is recommended.
static void apply_columnflag_from_list(struct column_control *ctl, const char *list,
int flag, const char *errmsg)
{
- char **all = split_or_error(list, errmsg);
+ char **all;
char **one;
int unnamed = 0;
+ struct libscols_column *cl;
- STRV_FOREACH(one, all) {
- struct libscols_column *cl;
+ /* apply to all */
+ if (list && strcmp(list, "0") == 0) {
+ struct libscols_iter *itr;
+
+ itr = scols_new_iter(SCOLS_ITER_FORWARD);
+ if (!itr)
+ err_oom();
+ while (scols_table_next_column(ctl->tab, itr, &cl) == 0)
+ column_set_flag(cl, flag);
+ scols_free_iter(itr);
+ }
+
+ all = split_or_error(list, errmsg);
+
+ /* apply to columns specified by name */
+ STRV_FOREACH(one, all) {
if (flag == SCOLS_FL_HIDDEN && strcmp(*one, "-") == 0) {
unnamed = 1;
continue;
/* apply flag to all columns without name */
if (unnamed) {
struct libscols_iter *itr;
- struct libscols_column *cl;
itr = scols_new_iter(SCOLS_ITER_FORWARD);
if (!itr)