Add an option to list only files (no directories)
Listing only files of a directory in Linux currently requires the combination of multiple tools, yet it could be done properly with the very tool whose purpose is to list files. This feature could work similarly to -d: by default, only list files of the current/specified directory, and when combined with --tree, list the files of the whole subtree of the current/specified directory.
A use-case for listing only files: in KDE, if one disables application menu bars in favor of the global menu (which may be located in a panel on the top of the screen), it is currently not possible to show the menu bar without changing an option in the individual config files of each application (located in .config) (MenuBar = Disabled must be replaced by MenuBar = Enabled in each file). So, it is necessary to run something like the sed command on each file of the directory (and not in sub-directories). The problem is that running sed ... * will try to run sed also on directories, which fails. The idea would be to have something like lsd --only-files, which could then be piped into other commands.
Your usecase sound like it would be better served with find than lsd.
You can use something like this:
find . -type d -depth 1
lsd is a replacement for ls, whose purpose is: list directory contents (cf. man ls).
Well in a directory, there are mainly very important type of things: files and sub-directories.
There is lsd -d, why not lsd --files-only ?
Of course using find is possible. As well as ls -lha | grep <whatever to filter out anything that is not a file>. Or writing a Java application. But all that is kind of not intuitive for such a simple task.
When one thinks: "I need the list of files of this particular directory (with or without the files from sub-directories)", the first thing that comes to mind is ls/lsd (as in "list") - just get the damn files and go on with whatever you do. It's not: "I need to search for files whose characteristic is that they are located in this directory".
In my opinion, find is something you use when you need to filter out anything that does not match some more complex criteria.
I am a bit astonished that nobody ever thought of adding this to ls/lsd. At the same time, I agree that writing an alias is easy. But not really that easy: you have to find out the right command, which requires knowledge of at least one other command and its parameters... Too much for just listing files of a directory.
Of course, one could then also add the same feature with symlinks, hardlinks... That's another story.
I unfortunately do not know Rust, else I would implement it myself and make a PR.
The reason I suggested to use find was because this is more of a niche usecase. In almost all situations, you want the entire directory contents to be listed and it is relatively rare that you just want to list just the files. Also, in most cases when you want to list just the file, the context is within a script in which find is a much better option. That said, if there is enough interest in this issue, we could think about adding something like -type flag of find.
Btw, the -d flag is actually not a filter for directories. This is used so that if you specify a directory name, it will print the directory info instead of the info for the directory contents. It does act like directory filter in tree mode though.
I realize you said you don't like using an alias, and I agree that a --files-only option would be handy, but you do not need to use a second program to accomplish what you want. The commands below return the output you seem to be looking for.
lsd --directory-only (.*|*)(^/) # Only list files
lsd --directory-only *(^/) # Only list visible files
lsd --directory-only .*(^/) # Only list hidden files
These also work with the standard ls command.
For above, you may need to exclude symlink dirs: *(^-/)
closing as this is a question solved