mirror of
https://codeberg.org/TicklishHoneyBee/CLIte.git
synced 2026-03-11 09:04:37 +00:00
add -a to ls (now that there are dot files)
This commit is contained in:
parent
39ebcdc049
commit
abf74e32c0
1 changed files with 7 additions and 0 deletions
|
|
@ -36,6 +36,7 @@ Use view or less to view the content, eg: view web/about
|
|||
clite.commands.load('ls',function(args,env,io) {
|
||||
var dirs = [];
|
||||
var long = false;
|
||||
var all = false;
|
||||
var stdlib = io.include('stdlib');
|
||||
var stdio = io.include('stdio');
|
||||
function help() {
|
||||
|
|
@ -46,6 +47,7 @@ Usage: ls [OPTION] [FILE]
|
|||
Options:
|
||||
-? Print this help information
|
||||
-l Display data in long format
|
||||
-a Do not ignore entries starting with .
|
||||
`);
|
||||
}
|
||||
|
||||
|
|
@ -75,6 +77,9 @@ Options:
|
|||
case 'l':
|
||||
long = true;
|
||||
break;
|
||||
case 'a':
|
||||
all = true;
|
||||
break;
|
||||
default:
|
||||
stdio.write(io.stderr,'unknown argument: -'+args[i][j]);
|
||||
}
|
||||
|
|
@ -103,6 +108,8 @@ Options:
|
|||
}
|
||||
var e;
|
||||
while ((e = stdio.read(fd)) != null) {
|
||||
if (e[0] == '.' && !all)
|
||||
continue;
|
||||
var efd = stdio.open(dir+'/'+e,false,true);
|
||||
if (!efd) {
|
||||
stdio.write(io.stderr,'cannot read contents: '+dir);
|
||||
|
|
|
|||
Loading…
Reference in a new issue