You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lesy is a simplified CLI framework build with NodeJS and Typescript. Main purpose of lesy is to enable web UI so that users can run commands from GUI dashboard without much complex. But lesy also shines in maintainability and flexibility focusing more on developer experience and performance.
32
+
33
+
## Features
30
34
31
35
-**Language**     - _Javascript and Typescript with @types_
32
36
-**Flexibility**     - _Able to change complete flow with middlewares_
Commands can be a simple object, or a function or a class. Also, you can provide a path to file or directory where lesy can discover all commands. There are lot of things you can do with commands like, deep nested sub commands, dynamic command execution, run asyncronous code, validate args and flags, etc.,
101
+
102
+
```js
103
+
constlesy=require("@lesy/compiler");
104
+
105
+
constcommands= [
106
+
{
107
+
name:"hello",
108
+
run: () =>console.log("Hello Buddy!"),
109
+
},
110
+
111
+
functionhello(cmd) {
112
+
cmd.name="hello";
113
+
cmd.run= () =>console.log("Hello Buddy!");
114
+
},
115
+
116
+
classHello {
117
+
name ="hello";
118
+
run() {
119
+
console.log("Hello Buddy!");
120
+
}
121
+
},
122
+
123
+
`${__dirname}/commands/welcome.ts`,
124
+
125
+
`${__dirname}/commands`,
126
+
];
127
+
128
+
lesy({ commands }).parse();
129
+
```
130
+
131
+
To know more about formats, args, flags, context [check here](https://lesyjs.io/docs/core/commands)
132
+
133
+
<br/>
134
+
135
+
-#### Middlewares
136
+
137
+
Middlewares are sort of hooks, you can plug a middleware at multiple stages of the flow. This way you can add, change and manipulate the flow.
console.log("this will be printed after hello world");
148
+
return ctx;
149
+
},
150
+
},
151
+
];
80
152
81
-
### Plugins
153
+
lesy({ commands, middlewares }).parse();
154
+
```
155
+
156
+
To know more about hook points, async middlewares, parsing, context [check here](https://lesyjs.io/docs/core/middlewares)
157
+
158
+
<br/>
159
+
160
+
-#### Features
161
+
162
+
Features are simple object, which are accesible in both commands and middlewares. It is super useful if you are dealing with third party libraries and want to share with all commands and middlewares.
To know more about features [check here](https://lesyjs.io/docs/core/features)
180
+
181
+
<br/>
182
+
183
+
-#### Plugins
184
+
185
+
Plugins are collection of commands, middlewares and features. Can be a local plugin or any lesy plugin that can be installed from npm. [learn more](https://lesyjs.io/docs/core/plugins)
0 commit comments