Skip to content

Commit 7aeeeb0

Browse files
compat flag
1 parent 46ff732 commit 7aeeeb0

45 files changed

Lines changed: 57 additions & 1 deletion

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/kernel.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ export class Kernel {
8080
throw new Error(`Command not found: ${command}`);
8181
}
8282

83+
let compat = "1.0.0";
84+
if (typeof program.compat === "string") {
85+
compat = program.compat;
86+
}
87+
88+
if (compat !== "2.0.0") {
89+
throw new Error(`Program ${program.name} is not compatible with OllieOS 2. (Add compat: "2.0.0" to the program object to mark it as ported.)`);
90+
}
91+
8392
// we may not be provided a parsed line (if this is a direct call, not from execute()), but we can create one by assumption
8493
const parsed_line: LineParseResultCommand = original_line_parse ?? {
8594
type: "command",

src/prog_registry.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ export const build_registrant_from_js = async (js_code: string, built_in = false
5454
console.warn(`Program ${program.name} has JS code starts with 'import'. Please update the package to use the new global externals system. This will be removed in the future.`);
5555
}
5656

57+
// not warning about compat here to make it more obvious to end users when they try to run an incompatible program
58+
5759
if (globalThis.OLLIEOS_NODE && program.node_opt_out) {
5860
throw new Error(`Program ${program.name} is not compatible with Node.js.`);
5961
}

src/programs/alias.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export default {
88
name: "The name of the alias to define or display. If no arguments are given, all aliases are displayed. Multiple alias arguments can be provided.",
99
"name=value": "Defines an alias with the given name and value. End the value with a space to allow chaining."
1010
},
11+
compat: "2.0.0",
1112
completion: async () => [],
1213
main: async (data) => {
1314
// extract from data to make code less verbose

src/programs/ascmagine.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export default {
2727
"-u": "Path is an web URL instead of a local filesystem path."
2828
}
2929
},
30+
compat: "2.0.0",
3031
// TODO: completion
3132
main: async (data) => {
3233
// extract from data to make code less verbose

src/programs/bugreport.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export default {
1717
feature: "Opens the bug reporter with the feature request template.",
1818
other: "Opens the bug reporter with the template chooser (default).",
1919
},
20+
compat: "2.0.0",
2021
completion: helper_completion_options(["bug", "feature", "other"]),
2122
main: async (data) => {
2223
// extract from data to make code less verbose

src/programs/cat.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export default {
1010
"filepaths": "The paths of the files to read."
1111
}
1212
},
13+
compat: "2.0.0",
1314
main: async (data) => {
1415
// extract from data to make code less verbose
1516
const { kernel, args, term } = data;

src/programs/cd.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export default {
88
arg_descriptions: {
99
path: "Path to directory to change to. If no path is given, change to home directory."
1010
},
11+
compat: "2.0.0",
1112
main: async (data) => {
1213
// extract from data to make code less verbose
1314
const { kernel, args, term } = data;

src/programs/clear.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export default {
1313
"-so": "Only clear the scrollback."
1414
}
1515
},
16+
compat: "2.0.0",
1617
completion: helper_completion_options(["-h", "-s", "-so"]),
1718
main: async (data) => {
1819
// extract from data to make code less verbose

src/programs/core/ash/core.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,11 @@ export class AshShell implements AbstractShell {
8787
document.title = old_title;
8888
}
8989

90-
term.writeln(`${PREFABS.error}Failed to execute command: ${FG.white + STYLE.italic}${command}${STYLE.reset_all}`);
90+
term.writeln(`${PREFABS.error}Failed to execute command: ${FG.white + STYLE.italic}${command}${STYLE.reset_all}.`);
91+
term.writeln(`${FG.red + STYLE.italic}${(e as Error).message}${STYLE.reset_all}`);
92+
9193
console.error(e);
94+
9295
return false;
9396
}
9497

src/programs/core/ash/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export default {
1212
"--login": "Start the shell as a login shell. Don't pass this flag manually, it's handled by the system."
1313
}
1414
},
15+
compat: "2.0.0",
1516
main: async (data) => {
1617
const {kernel, term, process, args} = data;
1718

0 commit comments

Comments
 (0)