@ecmaos/coreutils 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +25 -0
- package/LICENSE +1 -1
- package/dist/commands/cal.js +2 -2
- package/dist/commands/cal.js.map +1 -1
- package/dist/commands/cat.js +2 -2
- package/dist/commands/cd.js +2 -2
- package/dist/commands/chmod.d.ts.map +1 -1
- package/dist/commands/chmod.js +16 -11
- package/dist/commands/chmod.js.map +1 -1
- package/dist/commands/cp.js +2 -2
- package/dist/commands/cp.js.map +1 -1
- package/dist/commands/date.js +2 -2
- package/dist/commands/date.js.map +1 -1
- package/dist/commands/echo.js +2 -2
- package/dist/commands/echo.js.map +1 -1
- package/dist/commands/false.js +2 -2
- package/dist/commands/fetch.d.ts +4 -0
- package/dist/commands/fetch.d.ts.map +1 -0
- package/dist/commands/fetch.js +210 -0
- package/dist/commands/fetch.js.map +1 -0
- package/dist/commands/format.d.ts +4 -0
- package/dist/commands/format.d.ts.map +1 -0
- package/dist/commands/format.js +178 -0
- package/dist/commands/format.js.map +1 -0
- package/dist/commands/hash.d.ts +4 -0
- package/dist/commands/hash.d.ts.map +1 -0
- package/dist/commands/hash.js +200 -0
- package/dist/commands/hash.js.map +1 -0
- package/dist/commands/head.js +2 -2
- package/dist/commands/id.js +2 -2
- package/dist/commands/id.js.map +1 -1
- package/dist/commands/less.d.ts.map +1 -1
- package/dist/commands/less.js +53 -2
- package/dist/commands/less.js.map +1 -1
- package/dist/commands/ls.d.ts.map +1 -1
- package/dist/commands/ls.js +120 -97
- package/dist/commands/ls.js.map +1 -1
- package/dist/commands/man.d.ts +4 -0
- package/dist/commands/man.d.ts.map +1 -0
- package/dist/commands/man.js +554 -0
- package/dist/commands/man.js.map +1 -0
- package/dist/commands/mkdir.js +2 -2
- package/dist/commands/mkdir.js.map +1 -1
- package/dist/commands/mktemp.d.ts +4 -0
- package/dist/commands/mktemp.d.ts.map +1 -0
- package/dist/commands/mktemp.js +229 -0
- package/dist/commands/mktemp.js.map +1 -0
- package/dist/commands/nc.js +2 -2
- package/dist/commands/nc.js.map +1 -1
- package/dist/commands/passkey.js +3 -3
- package/dist/commands/pwd.js +2 -2
- package/dist/commands/pwd.js.map +1 -1
- package/dist/commands/rm.d.ts.map +1 -1
- package/dist/commands/rm.js +57 -12
- package/dist/commands/rm.js.map +1 -1
- package/dist/commands/rmdir.js +2 -2
- package/dist/commands/rmdir.js.map +1 -1
- package/dist/commands/sockets.js +1 -1
- package/dist/commands/stat.d.ts.map +1 -1
- package/dist/commands/stat.js +37 -15
- package/dist/commands/stat.js.map +1 -1
- package/dist/commands/tail.js +2 -2
- package/dist/commands/tar.d.ts +4 -0
- package/dist/commands/tar.d.ts.map +1 -0
- package/dist/commands/tar.js +693 -0
- package/dist/commands/tar.js.map +1 -0
- package/dist/commands/touch.js +2 -2
- package/dist/commands/touch.js.map +1 -1
- package/dist/commands/true.js +2 -2
- package/dist/commands/unzip.d.ts +4 -0
- package/dist/commands/unzip.d.ts.map +1 -0
- package/dist/commands/unzip.js +443 -0
- package/dist/commands/unzip.js.map +1 -0
- package/dist/commands/user.d.ts +4 -0
- package/dist/commands/user.d.ts.map +1 -0
- package/dist/commands/user.js +427 -0
- package/dist/commands/user.js.map +1 -0
- package/dist/commands/whoami.js +2 -2
- package/dist/commands/whoami.js.map +1 -1
- package/dist/commands/zip.d.ts +4 -0
- package/dist/commands/zip.d.ts.map +1 -0
- package/dist/commands/zip.js +264 -0
- package/dist/commands/zip.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -4
- package/src/commands/cal.ts +2 -2
- package/src/commands/cat.ts +2 -2
- package/src/commands/cd.ts +2 -2
- package/src/commands/chmod.ts +19 -11
- package/src/commands/cp.ts +2 -2
- package/src/commands/date.ts +2 -2
- package/src/commands/echo.ts +2 -2
- package/src/commands/false.ts +2 -2
- package/src/commands/fetch.ts +205 -0
- package/src/commands/format.ts +204 -0
- package/src/commands/hash.ts +215 -0
- package/src/commands/head.ts +2 -2
- package/src/commands/id.ts +2 -2
- package/src/commands/less.ts +50 -2
- package/src/commands/ls.ts +131 -91
- package/src/commands/man.ts +643 -0
- package/src/commands/mkdir.ts +2 -2
- package/src/commands/mktemp.ts +235 -0
- package/src/commands/nc.ts +2 -2
- package/src/commands/passkey.ts +3 -3
- package/src/commands/pwd.ts +2 -2
- package/src/commands/rm.ts +54 -12
- package/src/commands/rmdir.ts +2 -2
- package/src/commands/sockets.ts +1 -1
- package/src/commands/stat.ts +44 -16
- package/src/commands/tail.ts +2 -2
- package/src/commands/tar.ts +737 -0
- package/src/commands/touch.ts +2 -2
- package/src/commands/true.ts +2 -2
- package/src/commands/unzip.ts +517 -0
- package/src/commands/user.ts +436 -0
- package/src/commands/whoami.ts +2 -2
- package/src/commands/zip.ts +319 -0
- package/src/index.ts +28 -1
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import path from 'path'
|
|
2
|
+
import * as zipjs from '@zip.js/zip.js'
|
|
3
|
+
import type { Kernel, Process, Shell, Terminal } from '@ecmaos/types'
|
|
4
|
+
import { TerminalCommand } from '../shared/terminal-command.js'
|
|
5
|
+
import { writelnStdout, writelnStderr } from '../shared/helpers.js'
|
|
6
|
+
import chalk from 'chalk'
|
|
7
|
+
|
|
8
|
+
function printUsage(process: Process | undefined, terminal: Terminal): void {
|
|
9
|
+
const usage = `Usage: zip [OPTION]... ZIPFILE FILE...
|
|
10
|
+
Create a zip archive containing the specified files and directories.
|
|
11
|
+
|
|
12
|
+
-r, --recurse recurse into directories
|
|
13
|
+
-l, --list list contents of zip file
|
|
14
|
+
-v, --verbose verbose mode
|
|
15
|
+
-h, --help display this help and exit
|
|
16
|
+
|
|
17
|
+
Examples:
|
|
18
|
+
zip archive.zip file1.txt file2.txt
|
|
19
|
+
zip -r archive.zip directory/
|
|
20
|
+
zip -l archive.zip`
|
|
21
|
+
writelnStderr(process, terminal, usage)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface ZipOptions {
|
|
25
|
+
recurse: boolean
|
|
26
|
+
list: boolean
|
|
27
|
+
verbose: boolean
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function parseArgs(argv: string[]): { options: ZipOptions; zipfile: string | null; files: string[] } {
|
|
31
|
+
const options: ZipOptions = {
|
|
32
|
+
recurse: false,
|
|
33
|
+
list: false,
|
|
34
|
+
verbose: false
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const files: string[] = []
|
|
38
|
+
let zipfile: string | null = null
|
|
39
|
+
let i = 0
|
|
40
|
+
|
|
41
|
+
while (i < argv.length) {
|
|
42
|
+
const arg = argv[i]
|
|
43
|
+
if (!arg) {
|
|
44
|
+
i++
|
|
45
|
+
continue
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (arg === '--help' || arg === '-h') {
|
|
49
|
+
i++
|
|
50
|
+
continue
|
|
51
|
+
} else if (arg === '-r' || arg === '--recurse') {
|
|
52
|
+
options.recurse = true
|
|
53
|
+
i++
|
|
54
|
+
} else if (arg === '-l' || arg === '--list') {
|
|
55
|
+
options.list = true
|
|
56
|
+
i++
|
|
57
|
+
} else if (arg === '-v' || arg === '--verbose') {
|
|
58
|
+
options.verbose = true
|
|
59
|
+
i++
|
|
60
|
+
} else if (arg.startsWith('-')) {
|
|
61
|
+
// Handle combined flags like -rv
|
|
62
|
+
const flags = arg.slice(1).split('')
|
|
63
|
+
for (const flag of flags) {
|
|
64
|
+
if (flag === 'r') options.recurse = true
|
|
65
|
+
else if (flag === 'l') options.list = true
|
|
66
|
+
else if (flag === 'v') options.verbose = true
|
|
67
|
+
}
|
|
68
|
+
i++
|
|
69
|
+
} else {
|
|
70
|
+
// First non-option argument is the zipfile
|
|
71
|
+
if (!zipfile) {
|
|
72
|
+
zipfile = arg
|
|
73
|
+
} else {
|
|
74
|
+
files.push(arg)
|
|
75
|
+
}
|
|
76
|
+
i++
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return { options, zipfile, files }
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async function addDirectory(
|
|
84
|
+
zipWriter: zipjs.ZipWriter<Blob>,
|
|
85
|
+
dirPath: string,
|
|
86
|
+
basePath: string,
|
|
87
|
+
shell: Shell,
|
|
88
|
+
terminal: Terminal,
|
|
89
|
+
process: Process | undefined,
|
|
90
|
+
verbose: boolean
|
|
91
|
+
): Promise<void> {
|
|
92
|
+
const entries = await shell.context.fs.promises.readdir(dirPath)
|
|
93
|
+
|
|
94
|
+
for (const entry of entries) {
|
|
95
|
+
const entryPath = path.join(dirPath, entry)
|
|
96
|
+
const relativePath = path.relative(basePath, entryPath)
|
|
97
|
+
const entryStat = await shell.context.fs.promises.stat(entryPath)
|
|
98
|
+
|
|
99
|
+
if (entryStat.isFile()) {
|
|
100
|
+
const fileData = await shell.context.fs.promises.readFile(entryPath)
|
|
101
|
+
const reader = new zipjs.Uint8ArrayReader(fileData)
|
|
102
|
+
await zipWriter.add(relativePath, reader)
|
|
103
|
+
if (verbose) {
|
|
104
|
+
await writelnStdout(process, terminal, ` adding: ${relativePath}`)
|
|
105
|
+
}
|
|
106
|
+
} else if (entryStat.isDirectory()) {
|
|
107
|
+
await addDirectory(zipWriter, entryPath, basePath, shell, terminal, process, verbose)
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
async function listZipContents(
|
|
113
|
+
zipfilePath: string,
|
|
114
|
+
shell: Shell,
|
|
115
|
+
terminal: Terminal,
|
|
116
|
+
process: Process | undefined
|
|
117
|
+
): Promise<number> {
|
|
118
|
+
try {
|
|
119
|
+
const zipData = await shell.context.fs.promises.readFile(zipfilePath)
|
|
120
|
+
const blob = new Blob([new Uint8Array(zipData)])
|
|
121
|
+
const zipReader = new zipjs.ZipReader(new zipjs.BlobReader(blob))
|
|
122
|
+
const entries = await zipReader.getEntries()
|
|
123
|
+
|
|
124
|
+
if (entries.length === 0) {
|
|
125
|
+
await writelnStdout(process, terminal, 'Archive: ' + path.basename(zipfilePath))
|
|
126
|
+
await writelnStdout(process, terminal, ' Empty archive')
|
|
127
|
+
await zipReader.close()
|
|
128
|
+
return 0
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Calculate column widths
|
|
132
|
+
let maxLength = 0
|
|
133
|
+
let maxSize = 0
|
|
134
|
+
for (const entry of entries) {
|
|
135
|
+
if (entry.filename.length > maxLength) maxLength = entry.filename.length
|
|
136
|
+
const size = entry.uncompressedSize || 0
|
|
137
|
+
if (size > maxSize) maxSize = size
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const sizeWidth = Math.max(12, String(maxSize).length)
|
|
141
|
+
const nameWidth = Math.max(20, maxLength)
|
|
142
|
+
|
|
143
|
+
await writelnStdout(process, terminal, `Archive: ${path.basename(zipfilePath)}`)
|
|
144
|
+
await writelnStdout(process, terminal, '')
|
|
145
|
+
await writelnStdout(process, terminal,
|
|
146
|
+
` Length Date Time Name`.padEnd(nameWidth + sizeWidth + 20)
|
|
147
|
+
)
|
|
148
|
+
await writelnStdout(process, terminal,
|
|
149
|
+
` ${'-'.repeat(sizeWidth)} ${'-'.repeat(10)} ${'-'.repeat(5)} ${'-'.repeat(nameWidth)}`
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
let totalLength = 0
|
|
153
|
+
for (const entry of entries) {
|
|
154
|
+
const length = entry.uncompressedSize || 0
|
|
155
|
+
totalLength += length
|
|
156
|
+
|
|
157
|
+
let date = '--'
|
|
158
|
+
let time = '--'
|
|
159
|
+
|
|
160
|
+
if (entry.lastModDate) {
|
|
161
|
+
const d = new Date(entry.lastModDate)
|
|
162
|
+
const month = String(d.getMonth() + 1).padStart(2, '0')
|
|
163
|
+
const day = String(d.getDate()).padStart(2, '0')
|
|
164
|
+
const year = String(d.getFullYear()).slice(-2)
|
|
165
|
+
date = `${month}-${day}-${year}`
|
|
166
|
+
|
|
167
|
+
const hours = String(d.getHours()).padStart(2, '0')
|
|
168
|
+
const minutes = String(d.getMinutes()).padStart(2, '0')
|
|
169
|
+
time = `${hours}:${minutes}`
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const name = entry.directory ? entry.filename + '/' : entry.filename
|
|
173
|
+
const lengthStr = entry.directory ? '' : String(length).padStart(sizeWidth)
|
|
174
|
+
|
|
175
|
+
await writelnStdout(process, terminal,
|
|
176
|
+
` ${lengthStr.padEnd(sizeWidth)} ${date.padEnd(10)} ${time.padEnd(5)} ${name}`
|
|
177
|
+
)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
await writelnStdout(process, terminal,
|
|
181
|
+
` ${'-'.repeat(sizeWidth)} ${'-'.repeat(10)} ${'-'.repeat(5)} ${'-'.repeat(nameWidth)}`
|
|
182
|
+
)
|
|
183
|
+
await writelnStdout(process, terminal,
|
|
184
|
+
` ${String(totalLength).padStart(sizeWidth)} ${entries.length} file${entries.length !== 1 ? 's' : ''}`
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
await zipReader.close()
|
|
188
|
+
return 0
|
|
189
|
+
} catch (error) {
|
|
190
|
+
await writelnStderr(process, terminal,
|
|
191
|
+
chalk.red(`zip error: ${error instanceof Error ? error.message : 'Unknown error'}`)
|
|
192
|
+
)
|
|
193
|
+
return 1
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export function createCommand(kernel: Kernel, shell: Shell, terminal: Terminal): TerminalCommand {
|
|
198
|
+
return new TerminalCommand({
|
|
199
|
+
command: 'zip',
|
|
200
|
+
description: 'Create zip archives',
|
|
201
|
+
kernel,
|
|
202
|
+
shell,
|
|
203
|
+
terminal,
|
|
204
|
+
run: async (pid: number, argv: string[]) => {
|
|
205
|
+
const process = kernel.processes.get(pid) as Process | undefined
|
|
206
|
+
|
|
207
|
+
if (argv.length > 0 && (argv[0] === '--help' || argv[0] === '-h')) {
|
|
208
|
+
printUsage(process, terminal)
|
|
209
|
+
return 0
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const { options, zipfile, files } = parseArgs(argv)
|
|
213
|
+
|
|
214
|
+
// List mode
|
|
215
|
+
if (options.list) {
|
|
216
|
+
if (!zipfile) {
|
|
217
|
+
await writelnStderr(process, terminal, chalk.red('zip error: zipfile name required'))
|
|
218
|
+
await writelnStderr(process, terminal, "Try 'zip --help' for more information.")
|
|
219
|
+
return 1
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const zipfilePath = path.resolve(shell.cwd, zipfile)
|
|
223
|
+
const exists = await shell.context.fs.promises.exists(zipfilePath)
|
|
224
|
+
if (!exists) {
|
|
225
|
+
await writelnStderr(process, terminal, chalk.red(`zip error: ${zipfile}: No such file or directory`))
|
|
226
|
+
return 1
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return await listZipContents(zipfilePath, shell, terminal, process)
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Create mode
|
|
233
|
+
if (!zipfile) {
|
|
234
|
+
await writelnStderr(process, terminal, chalk.red('zip error: zipfile name required'))
|
|
235
|
+
await writelnStderr(process, terminal, "Try 'zip --help' for more information.")
|
|
236
|
+
return 1
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if (files.length === 0) {
|
|
240
|
+
await writelnStderr(process, terminal, chalk.red('zip error: nothing to do'))
|
|
241
|
+
await writelnStderr(process, terminal, "Try 'zip --help' for more information.")
|
|
242
|
+
return 1
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
const outputPath = path.resolve(shell.cwd, zipfile)
|
|
246
|
+
let zipWriter: zipjs.ZipWriter<Blob> | null = null
|
|
247
|
+
let hasError = false
|
|
248
|
+
|
|
249
|
+
try {
|
|
250
|
+
zipWriter = new zipjs.ZipWriter(new zipjs.BlobWriter())
|
|
251
|
+
|
|
252
|
+
for (const inputPath of files) {
|
|
253
|
+
const fullPath = path.resolve(shell.cwd, inputPath)
|
|
254
|
+
|
|
255
|
+
try {
|
|
256
|
+
const exists = await shell.context.fs.promises.exists(fullPath)
|
|
257
|
+
if (!exists) {
|
|
258
|
+
await writelnStderr(process, terminal, chalk.red(`zip warning: ${inputPath}: No such file or directory`))
|
|
259
|
+
hasError = true
|
|
260
|
+
continue
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
const fileStat = await shell.context.fs.promises.stat(fullPath)
|
|
264
|
+
|
|
265
|
+
if (fileStat.isFile()) {
|
|
266
|
+
// Add single file
|
|
267
|
+
const relativePath = path.relative(shell.cwd, fullPath)
|
|
268
|
+
const fileData = await shell.context.fs.promises.readFile(fullPath)
|
|
269
|
+
const reader = new zipjs.Uint8ArrayReader(fileData)
|
|
270
|
+
await zipWriter.add(relativePath, reader)
|
|
271
|
+
if (options.verbose) {
|
|
272
|
+
await writelnStdout(process, terminal, ` adding: ${relativePath}`)
|
|
273
|
+
}
|
|
274
|
+
} else if (fileStat.isDirectory()) {
|
|
275
|
+
if (options.recurse) {
|
|
276
|
+
// Add directory and contents recursively
|
|
277
|
+
await addDirectory(zipWriter, fullPath, shell.cwd, shell, terminal, process, options.verbose)
|
|
278
|
+
if (options.verbose) {
|
|
279
|
+
await writelnStdout(process, terminal, ` adding: ${path.relative(shell.cwd, fullPath)}/`)
|
|
280
|
+
}
|
|
281
|
+
} else {
|
|
282
|
+
await writelnStderr(process, terminal, chalk.yellow(`zip warning: ${inputPath}: is a directory (not added). Use -r to recurse into directories`))
|
|
283
|
+
hasError = true
|
|
284
|
+
}
|
|
285
|
+
} else {
|
|
286
|
+
await writelnStderr(process, terminal, chalk.red(`zip error: ${inputPath}: Not a file or directory`))
|
|
287
|
+
hasError = true
|
|
288
|
+
}
|
|
289
|
+
} catch (err: unknown) {
|
|
290
|
+
await writelnStderr(process, terminal,
|
|
291
|
+
chalk.red(`zip error: ${inputPath}: ${err instanceof Error ? err.message : 'Unknown error'}`)
|
|
292
|
+
)
|
|
293
|
+
hasError = true
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// Write the zip file
|
|
298
|
+
const blob = await zipWriter.close()
|
|
299
|
+
zipWriter = null // Clear reference after closing
|
|
300
|
+
await shell.context.fs.promises.writeFile(outputPath, new Uint8Array(await blob.arrayBuffer()))
|
|
301
|
+
|
|
302
|
+
if (options.verbose) {
|
|
303
|
+
await writelnStdout(process, terminal, ` zipfile: ${zipfile}`)
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return hasError ? 1 : 0
|
|
307
|
+
} catch (err: unknown) {
|
|
308
|
+
await writelnStderr(process, terminal,
|
|
309
|
+
chalk.red(`zip error: ${err instanceof Error ? err.message : 'Unknown error'}`)
|
|
310
|
+
)
|
|
311
|
+
return 1
|
|
312
|
+
} finally {
|
|
313
|
+
if (zipWriter) {
|
|
314
|
+
await zipWriter.close()
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
})
|
|
319
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -12,11 +12,14 @@ import { createCommand as createCd } from './commands/cd.js'
|
|
|
12
12
|
import { createCommand as createChmod } from './commands/chmod.js'
|
|
13
13
|
import { createCommand as createCp } from './commands/cp.js'
|
|
14
14
|
import { createCommand as createEcho } from './commands/echo.js'
|
|
15
|
+
import { createCommand as createFetch } from './commands/fetch.js'
|
|
15
16
|
import { createCommand as createGrep } from './commands/grep.js'
|
|
17
|
+
import { createCommand as createHash } from './commands/hash.js'
|
|
16
18
|
import { createCommand as createHead } from './commands/head.js'
|
|
17
19
|
import { createCommand as createLn } from './commands/ln.js'
|
|
18
20
|
import { createCommand as createLs } from './commands/ls.js'
|
|
19
21
|
import { createCommand as createMkdir } from './commands/mkdir.js'
|
|
22
|
+
import { createCommand as createMktemp } from './commands/mktemp.js'
|
|
20
23
|
import { createCommand as createMv } from './commands/mv.js'
|
|
21
24
|
import { createCommand as createNc } from './commands/nc.js'
|
|
22
25
|
import { createCommand as createPwd } from './commands/pwd.js'
|
|
@@ -27,10 +30,12 @@ import { createCommand as createStat } from './commands/stat.js'
|
|
|
27
30
|
import { createCommand as createTouch } from './commands/touch.js'
|
|
28
31
|
import { createCommand as createHex } from './commands/hex.js'
|
|
29
32
|
import { createCommand as createLess } from './commands/less.js'
|
|
33
|
+
import { createCommand as createMan } from './commands/man.js'
|
|
30
34
|
import { createCommand as createPasskey } from './commands/passkey.js'
|
|
31
35
|
import { createCommand as createSed } from './commands/sed.js'
|
|
32
36
|
import { createCommand as createTee } from './commands/tee.js'
|
|
33
37
|
import { createCommand as createTail } from './commands/tail.js'
|
|
38
|
+
import { createCommand as createTar } from './commands/tar.js'
|
|
34
39
|
import { createCommand as createBasename } from './commands/basename.js'
|
|
35
40
|
import { createCommand as createCal } from './commands/cal.js'
|
|
36
41
|
import { createCommand as createComm } from './commands/comm.js'
|
|
@@ -40,6 +45,7 @@ import { createCommand as createDiff } from './commands/diff.js'
|
|
|
40
45
|
import { createCommand as createDirname } from './commands/dirname.js'
|
|
41
46
|
import { createCommand as createFalse } from './commands/false.js'
|
|
42
47
|
import { createCommand as createFind } from './commands/find.js'
|
|
48
|
+
import { createCommand as createFormat } from './commands/format.js'
|
|
43
49
|
import { createCommand as createId } from './commands/id.js'
|
|
44
50
|
import { createCommand as createJoin } from './commands/join.js'
|
|
45
51
|
import { createCommand as createNl } from './commands/nl.js'
|
|
@@ -51,9 +57,12 @@ import { createCommand as createTest } from './commands/test.js'
|
|
|
51
57
|
import { createCommand as createTr } from './commands/tr.js'
|
|
52
58
|
import { createCommand as createTrue } from './commands/true.js'
|
|
53
59
|
import { createCommand as createUniq } from './commands/uniq.js'
|
|
60
|
+
import { createCommand as createUser } from './commands/user.js'
|
|
54
61
|
import { createCommand as createWc } from './commands/wc.js'
|
|
55
62
|
import { createCommand as createWhich } from './commands/which.js'
|
|
56
63
|
import { createCommand as createWhoami } from './commands/whoami.js'
|
|
64
|
+
import { createCommand as createZip } from './commands/zip.js'
|
|
65
|
+
import { createCommand as createUnzip } from './commands/unzip.js'
|
|
57
66
|
|
|
58
67
|
// Export individual command factories
|
|
59
68
|
export { createCommand as createCat } from './commands/cat.js'
|
|
@@ -61,10 +70,13 @@ export { createCommand as createCd } from './commands/cd.js'
|
|
|
61
70
|
export { createCommand as createChmod } from './commands/chmod.js'
|
|
62
71
|
export { createCommand as createCp } from './commands/cp.js'
|
|
63
72
|
export { createCommand as createEcho } from './commands/echo.js'
|
|
73
|
+
export { createCommand as createFetch } from './commands/fetch.js'
|
|
64
74
|
export { createCommand as createGrep } from './commands/grep.js'
|
|
75
|
+
export { createCommand as createHash } from './commands/hash.js'
|
|
65
76
|
export { createCommand as createLn } from './commands/ln.js'
|
|
66
77
|
export { createCommand as createLs } from './commands/ls.js'
|
|
67
78
|
export { createCommand as createMkdir } from './commands/mkdir.js'
|
|
79
|
+
export { createCommand as createMktemp } from './commands/mktemp.js'
|
|
68
80
|
export { createCommand as createMv } from './commands/mv.js'
|
|
69
81
|
export { createCommand as createPwd } from './commands/pwd.js'
|
|
70
82
|
export { createCommand as createRm } from './commands/rm.js'
|
|
@@ -73,22 +85,28 @@ export { createCommand as createStat } from './commands/stat.js'
|
|
|
73
85
|
export { createCommand as createTouch } from './commands/touch.js'
|
|
74
86
|
export { createCommand as createHex } from './commands/hex.js'
|
|
75
87
|
export { createCommand as createLess } from './commands/less.js'
|
|
88
|
+
export { createCommand as createMan } from './commands/man.js'
|
|
76
89
|
export { createCommand as createSed } from './commands/sed.js'
|
|
77
90
|
export { createCommand as createTee } from './commands/tee.js'
|
|
78
91
|
export { createCommand as createTail } from './commands/tail.js'
|
|
92
|
+
export { createCommand as createTar } from './commands/tar.js'
|
|
79
93
|
export { createCommand as createBasename } from './commands/basename.js'
|
|
80
94
|
export { createCommand as createCut } from './commands/cut.js'
|
|
81
95
|
export { createCommand as createDate } from './commands/date.js'
|
|
82
96
|
export { createCommand as createDiff } from './commands/diff.js'
|
|
83
97
|
export { createCommand as createDirname } from './commands/dirname.js'
|
|
84
98
|
export { createCommand as createFind } from './commands/find.js'
|
|
99
|
+
export { createCommand as createFormat } from './commands/format.js'
|
|
85
100
|
export { createCommand as createSort } from './commands/sort.js'
|
|
86
101
|
export { createCommand as createTest } from './commands/test.js'
|
|
87
102
|
export { createCommand as createTr } from './commands/tr.js'
|
|
88
103
|
export { createCommand as createUniq } from './commands/uniq.js'
|
|
104
|
+
export { createCommand as createUser } from './commands/user.js'
|
|
89
105
|
export { createCommand as createWc } from './commands/wc.js'
|
|
90
106
|
export { createCommand as createWhich } from './commands/which.js'
|
|
91
107
|
export { createCommand as createSockets } from './commands/sockets.js'
|
|
108
|
+
export { createCommand as createZip } from './commands/zip.js'
|
|
109
|
+
export { createCommand as createUnzip } from './commands/unzip.js'
|
|
92
110
|
|
|
93
111
|
/**
|
|
94
112
|
* Creates all coreutils commands.
|
|
@@ -101,11 +119,14 @@ export function createAllCommands(kernel: Kernel, shell: Shell, terminal: Termin
|
|
|
101
119
|
chmod: createChmod(kernel, shell, terminal),
|
|
102
120
|
cp: createCp(kernel, shell, terminal),
|
|
103
121
|
echo: createEcho(kernel, shell, terminal),
|
|
122
|
+
fetch: createFetch(kernel, shell, terminal),
|
|
104
123
|
grep: createGrep(kernel, shell, terminal),
|
|
124
|
+
hash: createHash(kernel, shell, terminal),
|
|
105
125
|
head: createHead(kernel, shell, terminal),
|
|
106
126
|
ln: createLn(kernel, shell, terminal),
|
|
107
127
|
ls: createLs(kernel, shell, terminal),
|
|
108
128
|
mkdir: createMkdir(kernel, shell, terminal),
|
|
129
|
+
mktemp: createMktemp(kernel, shell, terminal),
|
|
109
130
|
mv: createMv(kernel, shell, terminal),
|
|
110
131
|
pwd: createPwd(kernel, shell, terminal),
|
|
111
132
|
nc: createNc(kernel, shell, terminal),
|
|
@@ -116,6 +137,7 @@ export function createAllCommands(kernel: Kernel, shell: Shell, terminal: Termin
|
|
|
116
137
|
touch: createTouch(kernel, shell, terminal),
|
|
117
138
|
hex: createHex(kernel, shell, terminal),
|
|
118
139
|
less: createLess(kernel, shell, terminal),
|
|
140
|
+
man: createMan(kernel, shell, terminal),
|
|
119
141
|
passkey: createPasskey(kernel, shell, terminal),
|
|
120
142
|
sed: createSed(kernel, shell, terminal),
|
|
121
143
|
tail: createTail(kernel, shell, terminal),
|
|
@@ -129,6 +151,7 @@ export function createAllCommands(kernel: Kernel, shell: Shell, terminal: Termin
|
|
|
129
151
|
dirname: createDirname(kernel, shell, terminal),
|
|
130
152
|
false: createFalse(kernel, shell, terminal),
|
|
131
153
|
find: createFind(kernel, shell, terminal),
|
|
154
|
+
format: createFormat(kernel, shell, terminal),
|
|
132
155
|
id: createId(kernel, shell, terminal),
|
|
133
156
|
join: createJoin(kernel, shell, terminal),
|
|
134
157
|
nl: createNl(kernel, shell, terminal),
|
|
@@ -136,13 +159,17 @@ export function createAllCommands(kernel: Kernel, shell: Shell, terminal: Termin
|
|
|
136
159
|
seq: createSeq(kernel, shell, terminal),
|
|
137
160
|
sort: createSort(kernel, shell, terminal),
|
|
138
161
|
split: createSplit(kernel, shell, terminal),
|
|
162
|
+
tar: createTar(kernel, shell, terminal),
|
|
139
163
|
test: createTest(kernel, shell, terminal),
|
|
140
164
|
tr: createTr(kernel, shell, terminal),
|
|
141
165
|
true: createTrue(kernel, shell, terminal),
|
|
142
166
|
uniq: createUniq(kernel, shell, terminal),
|
|
167
|
+
user: createUser(kernel, shell, terminal),
|
|
143
168
|
wc: createWc(kernel, shell, terminal),
|
|
144
169
|
which: createWhich(kernel, shell, terminal),
|
|
145
|
-
whoami: createWhoami(kernel, shell, terminal)
|
|
170
|
+
whoami: createWhoami(kernel, shell, terminal),
|
|
171
|
+
zip: createZip(kernel, shell, terminal),
|
|
172
|
+
unzip: createUnzip(kernel, shell, terminal)
|
|
146
173
|
}
|
|
147
174
|
}
|
|
148
175
|
|