Skip to content

Allow multiple dir inputs #142

@mattalxndr

Description

@mattalxndr

This is the way tree, ls, du, etc work:

% tree /dev/dri /dev/bus
/dev/dri
|-- by-path
|   |-- pci-0000:00:02.0-card -> ../card1
|   `-- pci-0000:00:02.0-render -> ../renderD128
|-- card1
`-- renderD128
/dev/bus
`-- usb
    |-- 001
    |   |-- 001
    |   |-- 002
    |   `-- 003
    |-- 002
    |   |-- 001
    |   `-- 002
    |-- 003
    |   |-- 001
    |   `-- 002
    |-- 004
    |   |-- 001
    |   `-- 002
    |-- 005
    |   |-- 001
    |   `-- 002
    `-- 006
        `-- 001

10 directories, 16 files
% 
% tree /dev/{dri,bus}
/dev/dri
|-- by-path
|   |-- pci-0000:00:02.0-card -> ../card1
|   `-- pci-0000:00:02.0-render -> ../renderD128
|-- card1
`-- renderD128
/dev/bus
`-- usb
    |-- 001
    |   |-- 001
    |   |-- 002
    |   `-- 003
    |-- 002
    |   |-- 001
    |   `-- 002
    |-- 003
    |   |-- 001
    |   `-- 002
    |-- 004
    |   |-- 001
    |   `-- 002
    |-- 005
    |   |-- 001
    |   `-- 002
    `-- 006
        `-- 001

10 directories, 16 files
 

Would be great to have the same functionality in tre:

% tre /dev/dri /dev/bus
error: Found argument '/dev/bus' which wasn't expected, or isn't valid in this context

USAGE:
    tre [OPTIONS] [PATH]

For more information try --help
%
% tre /dev/{dri,bus}
error: Found argument '/dev/bus' which wasn't expected, or isn't valid in this context

USAGE:
    tre [OPTIONS] [PATH]

For more information try --help
 

Workaround

This works, if tossed into your init file:

tre() { printf '%s\0' "$@" | xargs -0 -n1 tre; }

Test:

% tre /dev/{dri,bus} /tmp/has\ space
/dev/dri
├── by-path
│   ├── pci-0000:00:02.0-render
│   └── pci-0000:00:02.0-card
├── card1
└── renderD128
/dev/bus
└── usb
    ├── 006
    │   └── 001
    ├── 005
    │   ├── 002
    │   └── 001
    ├── 004
    │   ├── 002
    │   └── 001
    ├── 002
    │   ├── 002
    │   └── 001
    ├── 003
    │   ├── 002
    │   └── 001
    └── 001
        ├── 003
        ├── 002
        └── 001
/tmp/has space
└── file.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions