*-e*, *--evaluate*::
Convert all tags (LABEL, UUID, PARTUUID, or PARTLABEL) to the corresponding device names for the SOURCE column. It's an unusual situation, but the same tag may be duplicated (used for more devices). For this purpose, there is SOURCES (pl.) column. This column displays by multi-line cell all devices where the tag is detected by libblkid. This option makes sense for _fstab_ only.
+*--hyperlink*[=_mode_]::
+Print mountpoint paths as terminal hyperlinks. The _mode_ can be set to "always", "never", or "auto". The optional argument _when_ can be set to "auto", "never", or "always". If the _when_ argument is omitted, it will default to "auto". The "auto" setting means that hyperlinks will only be used if the output is on a terminal.
+
*-F*, *--tab-file* _path_::
Search in an alternative file. If used with *--fstab*, *--mtab* or *--kernel*, then it overrides the default paths. If specified more than once, then tree-like output is disabled (see the *--list* option).
#include "mangle.h"
#include "buffer.h"
#include "column-list-table.h"
+#include "ttyutils.h"
#include "findmnt.h"
exit(EXIT_SUCCESS);
}
-static struct libscols_table *init_scols_table(unsigned int flags, bool use_filter)
+static struct libscols_table *init_scols_table(struct findmnt *findmnt)
{
struct libscols_table *table = scols_new_table();
+ unsigned int flags = findmnt->flags;
+ bool use_filter = findmnt->filter? true: false;
+
if (!table) {
warn(_("failed to allocate output table"));
goto leave;
warn(_("failed to allocate output column"));
goto leave;
}
+
+ if (findmnt->uri && id == COL_TARGET)
+ scols_column_set_uri(cl, findmnt->uri);
+
/* multi-line cells (now used for SOURCES) */
if (fl & SCOLS_FL_WRAP)
scols_column_set_wrapfunc(cl,
FINDMNT_OPT_PSEUDO,
FINDMNT_OPT_REAL,
FINDMNT_OPT_VFS_ALL,
- FINDMNT_OPT_SHADOWED
+ FINDMNT_OPT_SHADOWED,
+ FINDMNT_OPT_HYPERLINK
};
static const struct option longopts[] = {
{ "pseudo", no_argument, NULL, FINDMNT_OPT_PSEUDO },
{ "vfs-all", no_argument, NULL, FINDMNT_OPT_VFS_ALL },
{ "shadowed", no_argument, NULL, FINDMNT_OPT_SHADOWED },
+ { "hyperlink", optional_argument, NULL, FINDMNT_OPT_HYPERLINK },
{ "list-columns", no_argument, NULL, 'H' },
{ NULL, 0, NULL, 0 }
};
case FINDMNT_OPT_SHADOWED:
findmnt.flags |= FL_SHADOWED;
break;
-
+ case FINDMNT_OPT_HYPERLINK:
+ if (hyperlinkwanted_or_err(optarg,
+ _("invalid hyperlink argument")))
+ findmnt.uri = xgethosturi(NULL);
+ break;
case 'H':
collist = 1;
break;
* initialize libsmartcols
*/
scols_init_debug(0);
- table = init_scols_table(findmnt.flags, findmnt.filter? true: false);
+ table = init_scols_table(&findmnt);
if (!table)
goto leave;
init_scols_filter(table, findmnt.filter, findmnt.flags);
+
/*
* Fill in data to the output table
*/