Feature request: search
Hello! Since duc stores file names in the database it would be nice to be able to search for some regexp/pattern within file names.
Quoting innerspacepilot (2019-11-01 00:30:45)
Since duc stores file names in the database it would be nice to be able to search for some regexp/pattern within file names.
Not a bad idea, I'll leave this issue open as a reminder. For now, you might get away with something like
duc ls --full-path -R | grep thisorthat
-- :wq ^X^Cy^K^X^C^C^C^C
"Ico" == Ico Doornekamp [email protected] writes:
Ico> Quoting innerspacepilot (2019-11-01 00:30:45)
Since duc stores file names in the database it would be nice to be able to search for some regexp/pattern within file names.
Ico> Not a bad idea, I'll leave this issue open as a reminder. For now, you Ico> might get away with something like
Ico> duc ls --full-path -R | grep thisorthat
Why don't we just update the docs to reflect this usage? I'd hate to re-implement egrep inside duc just for simple searching like this. Using a pipe seems like the best way honestly.
Now maybe we add a more grep friendly output to duc, that makes more sense.
John
Hi John, long time!
Quoting John (2019-11-02 18:54:36)
Why don't we just update the docs to reflect this usage? I'd hate to re-implement egrep inside duc just for simple searching like this. Using a pipe seems like the best way honestly.
Yeah, but putting this in the docs is a bit funny, there's probably a thousand things you can do with duc piping its output somewhere, that's really up to the user.
Now maybe we add a more grep friendly output to duc, that makes more sense.
What more would you want then the above? You get full paths, so thats about the same as 'locate' would give you.
-- :wq ^X^Cy^K^X^C^C^C^C
Yep, piping to external grep is good enough, but instead of using ls there should be a separate command to dump all known entries with full path. Or something like this could happen:
duc ls --full-path -R /
Path / not found in database
Requested path not found
Segmentation fault (core dumped)
`duc ls --full-path -R / Path / not found in database Requested path not found Segmentation fault (core dumped)
The 'segmentation fault' is what worries me most here, what version of Duc are you running exactly?
-- :wq ^X^Cy^K^X^C^C^C^C
version is 1.4.4 from AUR https://aur.archlinux.org/packages/duc/ built with leveldb steps to reproduce: delete .duc.db/ .duc.db., run duc ls /
Quoting innerspacepilot (2019-11-03 11:30:37)
version is 1.4.4 from AUR https://aur.archlinux.org/packages/duc/ built with leveldb steps to reproduce: delete .duc.db/ .duc.db., run duc ls /
Ah yes, that was fixed in master but did not end up in a release yet. Maybe a good reason to create 1.4.5 one of these days.
Thanks,
"innerspacepilot" == innerspacepilot [email protected] writes:
innerspacepilot> Yep, using external grep is good enough,
I really like the unix philosophy of tools doing one thing well, and being chained together with pipes. Since it just hit the 50th anniversary of Unix, I've been re-reading some of the documents about it. Really fascinating stuff.
innerspacepilot> but instead of using ls there should be a separate innerspacepilot> command to dump all known entries with full path. Or innerspacepilot> something like this could happen:
innerspacepilot> duc ls --full-path -R / Path / not found in database Requested path not found Segmentation fault innerspacepilot> (core dumped)
This is a bug which needs to be fixed, otherwise I think the 'duc ls ...' is fine.
John
"Ico" == Ico Doornekamp [email protected] writes:
Ico> Hi John, long time! Ico> Quoting John (2019-11-02 18:54:36)
Why don't we just update the docs to reflect this usage? I'd hate to re-implement egrep inside duc just for simple searching like this. Using a pipe seems like the best way honestly.
Ico> Yeah, but putting this in the docs is a bit funny, there's probably a Ico> thousand things you can do with duc piping its output somewhere, that's Ico> really up to the user.
Very true, but it doesn't hurt to give some usage examples at the end of the man page... I'll see if I can whip up a patch sometime soon.
Now maybe we add a more grep friendly output to duc, that makes more sense.
Ico> What more would you want then the above? You get full paths, so Ico> thats about the same as 'locate' would give you.
More in terms of making the output always be on a single line, and not human readable so much. That's it mostly.
John
@l8gravely Unix philosophy is no doubt, but also some respect should be payed to usability. Users don't like typing sets of --some-long-options and --other-options.
So if you feel that duc ls --full-path -R / is enough, at least short option should be assigned for --full-path