@flowscripter/example-cli-plugin 1.1.3 → 1.2.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/README.md +13 -0
- package/dist/src/command/HelloRustCommand.d.ts +4 -0
- package/dist/src/command/HelloRustCommand.d.ts.map +1 -0
- package/dist/src/command/HelloRustCommand.js +16 -0
- package/dist/src/factory/DemoCommandFactory.d.ts.map +1 -1
- package/dist/src/factory/DemoCommandFactory.js +2 -1
- package/package.json +2 -1
- package/src/command/HelloRustCommand.ts +23 -0
- package/src/factory/DemoCommandFactory.ts +2 -1
package/README.md
CHANGED
|
@@ -76,13 +76,26 @@ classDiagram
|
|
|
76
76
|
+execute(context, argumentValues) void
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
class helloRustCommand {
|
|
80
|
+
<<SubCommand>>
|
|
81
|
+
+name: "hello_rust"
|
|
82
|
+
+execute(context) void
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
class world {
|
|
86
|
+
<<@flowscripter/template-bun-rust-library>>
|
|
87
|
+
+world() void
|
|
88
|
+
}
|
|
89
|
+
|
|
79
90
|
Plugin --> DemoCommandFactory : extensionDescriptor
|
|
80
91
|
Plugin --> DemoServiceProviderFactory : extensionDescriptor
|
|
81
92
|
DemoCommandFactory --> helloCommand : getCommands()
|
|
93
|
+
DemoCommandFactory --> helloRustCommand : getCommands()
|
|
82
94
|
DemoServiceProviderFactory --> DemoServiceProvider : getServiceProviders()
|
|
83
95
|
DemoServiceProvider --> DefaultDemoService : creates
|
|
84
96
|
DefaultDemoService ..|> DemoService
|
|
85
97
|
helloCommand --> DemoService : uses via context
|
|
98
|
+
helloRustCommand --> world : calls
|
|
86
99
|
```
|
|
87
100
|
|
|
88
101
|
### Framework API
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HelloRustCommand.d.ts","sourceRoot":"","sources":["../../../src/command/HelloRustCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAGX,MAAM,gDAAgD,CAAC;AAIxD,QAAA,MAAM,gBAAgB,EAAE,UAYvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PRINTER_SERVICE_ID } from "@flowscripter/dynamic-cli-framework/cli-plugin";
|
|
2
|
+
import { world } from "@flowscripter/template-bun-rust-library";
|
|
3
|
+
const helloRustCommand = {
|
|
4
|
+
name: "hello_rust",
|
|
5
|
+
description: "Greet using a native Rust library via FFI",
|
|
6
|
+
helpTopic: "Hello",
|
|
7
|
+
enableConfiguration: false,
|
|
8
|
+
options: [],
|
|
9
|
+
positionals: [],
|
|
10
|
+
execute: async (context) => {
|
|
11
|
+
const printerService = context.getServiceById(PRINTER_SERVICE_ID);
|
|
12
|
+
await printerService?.print("Hello ");
|
|
13
|
+
world();
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
export default helloRustCommand;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DemoCommandFactory.d.ts","sourceRoot":"","sources":["../../../src/factory/DemoCommandFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;
|
|
1
|
+
{"version":3,"file":"DemoCommandFactory.d.ts","sourceRoot":"","sources":["../../../src/factory/DemoCommandFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAIrF,MAAM,CAAC,OAAO,OAAO,kBAAmB,YAAW,cAAc;IAC/D,WAAW;CAGZ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowscripter/example-cli-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Example CLI plugin for the https://github.com/flowscripter/dynamic-cli-framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bun",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"build": "tsc -p tsconfig.build.json"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
+
"@flowscripter/template-bun-rust-library": "^1.2.5",
|
|
45
46
|
"cowsay": "^1.6.0"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
SubCommand,
|
|
3
|
+
Context,
|
|
4
|
+
PrinterService,
|
|
5
|
+
} from "@flowscripter/dynamic-cli-framework/cli-plugin";
|
|
6
|
+
import { PRINTER_SERVICE_ID } from "@flowscripter/dynamic-cli-framework/cli-plugin";
|
|
7
|
+
import { world } from "@flowscripter/template-bun-rust-library";
|
|
8
|
+
|
|
9
|
+
const helloRustCommand: SubCommand = {
|
|
10
|
+
name: "hello_rust",
|
|
11
|
+
description: "Greet using a native Rust library via FFI",
|
|
12
|
+
helpTopic: "Hello",
|
|
13
|
+
enableConfiguration: false,
|
|
14
|
+
options: [],
|
|
15
|
+
positionals: [],
|
|
16
|
+
execute: async (context: Context) => {
|
|
17
|
+
const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
|
|
18
|
+
await printerService?.print("Hello ");
|
|
19
|
+
world();
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default helloRustCommand;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { CommandFactory } from "@flowscripter/dynamic-cli-framework/cli-plugin";
|
|
2
2
|
import helloCommand from "../command/HelloCommand.ts";
|
|
3
|
+
import helloRustCommand from "../command/HelloRustCommand.ts";
|
|
3
4
|
|
|
4
5
|
export default class DemoCommandFactory implements CommandFactory {
|
|
5
6
|
getCommands() {
|
|
6
|
-
return [helloCommand];
|
|
7
|
+
return [helloCommand, helloRustCommand];
|
|
7
8
|
}
|
|
8
9
|
}
|