Type filter
pls allows the user to only list specific node types in the output.
Arguments
Section titled “Arguments”--typ/-t can be used to select the node types the user wants to see. The
flag can be specified multiple times to enable multiple file types. Each time it
can take one of these values.
| Value | Description |
|---|---|
| dir | regular folder |
| symlink | symbolic link |
| fifo | named pipe |
| socket | file-based socket |
| block_device | block special device file |
| char_device | character special device file |
| file | regular file |
| none | shorthand: no node types |
| all | shorthand: all node types |
Mechanism
Section titled “Mechanism”When parsing the --typ/-t flag, values are read from the CLI, in order, and
added to a vector of node types till we encounter a shorthand value. If the
shorthand value is none, the vector is cleared. If the shorthand value is
all, the vector is filled with all the node types.
For example, consider the pls invocation below.
pls --typ=symlink --typ=all --typ=none --typ=dirsymlinkis added to the list.- All the file types are added to the list, including the already existing
symlink. - All entries so far are dropped when
noneis encountered. diris added to the list.
The final set contains only dir and so pls will only list the directories.
Examples
Section titled “Examples”pls # or --typ=all or --t=all dir/ block_dev@ /dev/disk0 char_dev@ /dev/null fifo| file socket= sym@ ./dirpls --typ=dir --typ=symlink # or -t=dir -t=symlink dir/ block_dev@ /dev/disk0 char_dev@ /dev/null sym@ ./dirpls --typ=dir --typ=symlink fifo # `--typ` has no effect fifo|