Fix behavior to match ls's when the -d flag but no files or directories
were passed.
Fix bug that the function thinks -d is passed when a long option that
contains a 'd' (as --group-directories-first) is specified and thus
just emulates plain `ls` in that case.