@moostjs/event-cli 0.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 ADDED
@@ -0,0 +1,42 @@
1
+ # @moostjs/event-cli
2
+
3
+ **!!! This is work-in-progress library, breaking changes are expected !!!**
4
+
5
+ <p align="center">
6
+ <img src="../../moost-logo.png" width="450px"><br>
7
+ <a href="https://github.com/moostjs/moostjs/blob/main/LICENSE">
8
+ <img src="https://img.shields.io/badge/License-MIT-green?style=for-the-badge" />
9
+ </a>
10
+ </p>
11
+
12
+ `event-cli` is a moostjs wrapper of [@wooksjs/event-cli](https://github.com/wooksjs/wooksjs/tree/main/packages/event-cli) with corresponding decorators for composable functions.
13
+
14
+ ## Quick Start
15
+
16
+ ```ts
17
+ import { MoostCli, Flag, Cli } from '@moostjs/event-cli'
18
+ import { Moost } from 'moost'
19
+
20
+ class MyApp extends Moost {
21
+ @Cli('command')
22
+ command(@Flag('test') test: string | boolean) {
23
+ return `command run with flag test=${ test }`
24
+ }
25
+ }
26
+
27
+ const app = new MyApp()
28
+
29
+ const cli = new MoostCli()
30
+ app.adapter(cli)
31
+ app.init()
32
+
33
+ // Run compiled file as CLI with `command --test`
34
+ // The output:
35
+ // "command run with flag test=true"
36
+ ```
37
+
38
+
39
+
40
+ ## Install
41
+
42
+ `npm install moost @moostjs/event-cli`