some new commands; lfs wip

This commit is contained in:
minjaesong
2023-05-11 20:19:49 +09:00
parent 1efec13ecf
commit 803b86ce43
4 changed files with 49 additions and 3 deletions

View File

@@ -1,13 +1,14 @@
function printUsage() {
println(`Usage: gzip [-c] [-d] file
println(`Compresses or de-compresses (with -D flag) a file in-place, or to stdout if -C flag is set.
Usage: gzip [-c] [-d] file
To compress a file, replacing it with a gzipped compressed version:
gzip file.ext
To decompress a file, replacing it with the original uncompressed version:
gzip -d file.ext.gz
To compress a file specifying the output filename:
gzip -c file.ext > compressed_file.ext.gz
gzip -c file.ext | writeto compressed_file.ext.gz
To decompress a gzipped file specifying the output filename:
gzip -c -d file.ext.gz > uncompressed_file.ext`)
gzip -c -d file.ext.gz | writeto uncompressed_file.ext`)
}
if (exec_args[1] === undefined) {

View File

@@ -0,0 +1,21 @@
function printUsage() {
println(`Collects files under a directory into a single archive.
Usage: lfs [-c/-x/-t] dest.lfs path\\to\\source
To collect a directory into myarchive.lfs:
lfs -c myarchive.lfs path\\to\\directory
To extract an archive to path\\to\\my\\files:
lfs -x myarchive.lfs \\path\\to\\my\\files
To list the collected files:
lfs -t`)
}
const option = exec_args[1]
const lfsPath = exec_args[2]
const dirPath = exec_args[3]
if (option === undefined || lfsPath === undefined || option.toUpperCase() != "-T" && dirPath === undefined) {
printUsage()
return 0
}

View File

@@ -0,0 +1,13 @@
if (exec_args[1] === undefined) {
println("Usage: after a pipe,\n tee filename")
return 0
}
if (!_G.shell.hasPipe()) {
println("Pipe not opened")
return 1
}
let txt = _G.shell.getPipe()
files.open(_G.shell.resolvePathInput(exec_args[1]).full).swrite(txt)
print(txt)

View File

@@ -0,0 +1,11 @@
if (exec_args[1] === undefined) {
println("Usage: after a pipe,\n writeto filename")
return 0
}
if (!_G.shell.hasPipe()) {
println("Pipe not opened")
return 1
}
files.open(_G.shell.resolvePathInput(exec_args[1]).full).swrite(_G.shell.getPipe())