From 3906795007f01e33c6cd58d496bddbd15acead8d Mon Sep 17 00:00:00 2001 From: Lisa Milne Date: Thu, 9 Nov 2023 18:42:52 +1000 Subject: [PATCH] add support for opening a file without loading, fix a resolvePath bug in touch, add file command --- clite/commands.js | 94 ++++++++++++++++++++++++++++++++++++++++++++--- clite/core.js | 4 +- 2 files changed, 92 insertions(+), 6 deletions(-) diff --git a/clite/commands.js b/clite/commands.js index 65a36cc..27a596a 100644 --- a/clite/commands.js +++ b/clite/commands.js @@ -218,11 +218,7 @@ Options: } } }else if (file == null) { - if (args[i][0] == '/') { - file = args[i]; - }else{ - file = stdlib.resolvePath(args[i],false); - } + file = stdlib.resolvePath(args[i],false); }else{ io.error('unknown argument: '+args[i]); } @@ -242,14 +238,102 @@ Options: }); clite.commands.load('less',function(args,env,io) { + io.write('less is under development'); return 0; }); clite.commands.load('view',function(args,env,io) { + io.write('view is under development'); return 0; }); clite.commands.load('edit',function(args,env,io) { + io.write('edit is under development'); + return 0; +}); + +clite.commands.load('file',function(args,env,io) { + var short = ''; + var file = null; + var stdlib = io.include('stdlib'); + var stdio = io.include('stdio'); + function help() { + io.write(` +file - determine type of FILE +Usage: touch [OPTION] [FILE] + +Options: +-? Print this help information + `); + } + + for (var i=1; i