Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Required argument --pattern not found even when given #237

Open
Kushagra-0801 opened this issue Aug 23, 2023 · 3 comments
Open

Required argument --pattern not found even when given #237

Kushagra-0801 opened this issue Aug 23, 2023 · 3 comments

Comments

@Kushagra-0801
Copy link

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.

  1. How can I have globbing work for both files and directories at the same time?
  2. 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.
@solidiquis
Copy link
Owner

That is a bug. I'll work on getting that fixed ASAP. As for your questions:

  1. Globbing for different file-types in one query isn't supported, but I'll work on getting that supported for the next release.
  2. 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.

@Kushagra-0801
Copy link
Author

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.

@solidiquis
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants