erdtree
erdtree copied to clipboard
Required argument `--pattern` not found even when given
I wanted to used erd as an ls replacement. Since ls allows globbing without flags, I thought to make an alias for erd with the -p already present.
I made it like this:
In config file:
[ls]
human = true
disk-usage = "logical"
long = true
level = 1
suppress-size = true
layout = "inverted"
[lsf]
human = true
disk-usage = "logical"
long = true
level = 1
suppress-size = true
layout = "inverted"
glob = true
and then the aliases:
alias ls='erd --config ls'
alias lsf='erd --config lsf --pattern'
And I tried to use it like
lsf '*'
I get the following error:
error: the following required arguments were not provided:
--pattern <PATTERN>
Usage: -- --pattern <PATTERN> --suppress-size --glob --human --level <NUM> --disk-usage <DISK_USAGE> --long --layout <LAYOUT> [DIR]
For more information, try '--help'.
If I run
lsf --pattern '*'
I get the following error:
error: a value is required for '--pattern <PATTERN>' but none was supplied
For more information, try '--help'.
But if I run
ls --glob --pattern '*'
then it works.
Beyond this main issue, I have some other minor requests / questions as well.
- How can I have globbing work for both files and directories at the same time?
- Is there some way I can pass the pattern without quoting it? Basically, letting the shell do the globbing and have erd work like ls with arguments given.
That is a bug. I'll work on getting that fixed ASAP. As for your questions:
- Globbing for different file-types in one query isn't supported, but I'll work on getting that supported for the next release.
- Could you provide an example for this use-case? I don't see how this would work given that
erdexpects only a single positional argument which is the directory to traverse, but perhaps it'll make sense once I see what you're trying to accomplish.
Could you provide an example for this use-case? I don't see how this would work given that erd expects only a single positional argument which is the directory to traverse, but perhaps it'll make sense once I see what you're trying to accomplish.
With log files or static assets or in just a lot of cases, it happen that I have a couple hundred files in a directory. With ls I would do ls *-2023-08-* to list out all log files in august. I can do this with erd as well but it requires quoting. erd --glob --pattern '*-2023-08-*'. Even without the globs, sometimes I want to check whether a file just exists or not so running ls with the filename is what I do. Doing the same with erd fails with either can't compute root node or too many arguments.
It's not a huge problem to be honest, but old habits die hard.
ahhh okay that makes sense. Ignore what I said earlier about it not being possible, I didn't correctly envision what you were asking for. It should definitely be possible. I'll add that into my list of todos to include in the next release.