-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from jupyterlite/wasm-commands
Use WASM commands
- Loading branch information
Showing
41 changed files
with
11,958 additions
and
953 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,5 @@ npm t | |
|
||
To run single test file | ||
```bash | ||
npm t -- test/whatever.ts | ||
npm t -- tests/whatever.ts | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { ICommandRunner } from "./command_runner" | ||
import { Context } from "../context" | ||
|
||
export class BuiltinCommandRunner implements ICommandRunner { | ||
names(): string[] { | ||
return ["cd"] | ||
} | ||
|
||
async run(cmdName: string, context: Context): Promise<void> { | ||
switch (cmdName) { | ||
case "cd": | ||
this._cd(context) | ||
break | ||
} | ||
} | ||
|
||
private _cd(context: Context) { | ||
const { args } = context | ||
if (args.length < 1) { | ||
// Do nothing. | ||
return; | ||
} | ||
const path = args[0] // Ignore other arguments? | ||
// Need to handle path of "-". Maybe previous path is in an env var? | ||
context.fileSystem.FS.chdir(path) | ||
// Need to set PWD env var? | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { Context } from "../context" | ||
|
||
export interface ICommandRunner { | ||
names(): string[] | ||
run(cmdName: string, context: Context): Promise<void> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import * as CoreutilsModule from "../wasm/coreutils" | ||
import { WasmCommandRunner } from "./wasm_command_runner" | ||
|
||
export class CoreutilsCommandRunner extends WasmCommandRunner { | ||
names(): string[] { | ||
return [ | ||
// File commands | ||
"cp", "echo", "env", "ln", "ls", "mkdir", "mv", "pwd", "realpath", "rm", "rmdir", "touch", "uname", | ||
// Text commands | ||
"cat", "cut", "head", "join", "md5sum", "nl", "sha1sum", "sha224sum", "sha256sum", | ||
"sha384sum", "sha512sum", "sort", "tail", "tr", "wc", | ||
// Shell commands | ||
"basename", "date", "dirname", "echo", "env", "expr", "id", "logname", "pwd", "seq", "sleep", | ||
"stat", "uname", | ||
] | ||
} | ||
|
||
protected _getWasmModule(): any { | ||
return CoreutilsModule.default | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.