fix ,* filtering in ls

This commit is contained in:
b1ek 2023-03-20 21:04:07 +10:00
parent bf501ededa
commit 3e3553fd81
Signed by: blek
GPG Key ID: 14546221E3595D0C
1 changed files with 4 additions and 5 deletions

View File

@ -24,10 +24,6 @@ module.exports = (argv, terminal) => {
directories.shift();
// remove .* files if -a not specified
if (!all)
directories = directories.filter(x => !x.startsWith('.'));
// remove arguments
directories = directories.filter(x => !x.startsWith('-'));
@ -52,7 +48,10 @@ module.exports = (argv, terminal) => {
terminal.writeln(`${argv[0]}: cannot access '${dir}': No such file or directory`);
return;
}
let files = fs.readdirSync(dir);
let files = ['.', '..', ...fs.readdirSync(dir)];
if (!all)
files = files.filter(x => !x.startsWith('.'));
files.forEach((file, i) => {
if (!long_format)