@flowscripter/example-cli-plugin
v3.0.15
Published
Example CLI plugin for the https://github.com/flowscripter/dynamic-cli-framework
Maintainers
Readme
example-cli-plugin
Example CLI plugin for the dynamic-cli-framework
This plugin is authored against
@flowscripter/dynamic-cli-framework-api,
the lightweight plugin-facing API package, rather than the full
dynamic-cli-framework - keeping the framework's concrete service
implementations and their dependencies out of the plugin's own
dependency tree.
Development
Build (produces dist/ for Node.js and TypeScript consumers; Bun uses raw source directly):
bun run build
Test:
bun test
Format:
bunx oxfmt
Lint:
bunx oxlint index.ts src/ tests/
Generate HTML API Documentation:
bunx typedoc index.ts
Documentation
Overview
classDiagram
class Plugin {
<<interface>>
+extensionDescriptors: ExtensionDescriptor[]
}
class DemoCommandFactory {
<<CommandFactory>>
+getCommands() SubCommand[]
}
class DemoServiceProviderFactory {
<<ServiceProviderFactory>>
+getServiceProviders() ServiceProvider[]
}
class DemoServiceProvider {
<<ServiceProvider>>
+serviceId: string
+servicePriority: number
+getServiceInfo(cliConfig) ServiceInfo
+initService(context) void
}
class DemoService {
<<interface>>
+greet(name: string) string
}
class DefaultDemoService {
+greet(name: string) string
}
class helloCommand {
<<SubCommand>>
+name: "hello"
+positionals: name
+execute(context, argumentValues) void
}
class helloRustCommand {
<<SubCommand>>
+name: "hello_rust"
+execute(context) void
}
class world {
<<@flowscripter/template-bun-rust-library>>
+world() void
}
Plugin --> DemoCommandFactory : extensionDescriptor
Plugin --> DemoServiceProviderFactory : extensionDescriptor
DemoCommandFactory --> helloCommand : getCommands()
DemoCommandFactory --> helloRustCommand : getCommands()
DemoServiceProviderFactory --> DemoServiceProvider : getServiceProviders()
DemoServiceProvider --> DefaultDemoService : creates
DefaultDemoService ..|> DemoService
helloCommand --> DemoService : uses via context
helloRustCommand --> world : callsFramework API
Refer to the dynamic-cli-framework for an overview of what this example is demonstrating.
API
Link to auto-generated API docs:
License
MIT © Flowscripter
