From abf74e32c0b272ed06b5c00fded8c30f92f0b9f3 Mon Sep 17 00:00:00 2001 From: Lisa Milne Date: Sun, 26 Nov 2023 14:28:24 +1000 Subject: [PATCH] add -a to ls (now that there are dot files) --- clite/commands.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/clite/commands.js b/clite/commands.js index 35ca466..b5af7de 100644 --- a/clite/commands.js +++ b/clite/commands.js @@ -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);