Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita3db318

Browse files
committed
CLI in Reason?
1 parenta5af45f commita3db318

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

‎bindings/meow.re‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
moduleFlag= {
2+
[@bs.deriving abstract]
3+
typeflag= {
4+
[@bs.optional] [@bs.as "type"]
5+
type_:string,
6+
};
7+
};
8+
9+
moduleConfig= {
10+
[@bs.deriving abstract]
11+
typeconfig= {flags:Js.Dict.t(Flag.flag)};
12+
};
13+
14+
moduleCLI= {
15+
[@bs.deriving abstract]
16+
typecli= {
17+
flags:Js.Dict.t(Js.Json.t),
18+
input:array(string),
19+
};
20+
};
21+
22+
[@bs.module]externalmake: (string,Config.config) =>CLI.cli="meow";

‎src/cli.re‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
letdecodeBoolean= booleanOption=>
2+
booleanOption
3+
|> (
4+
fun
5+
|Some(debugMode)=>Js.Json.decodeBoolean(debugMode)
6+
|None=>None
7+
)
8+
|> (
9+
fun
10+
|Some(bool)whenbool ==Js.true_=>true
11+
|Some(bool)whenbool ==Js.false_=>false
12+
|_=>false
13+
);
14+
15+
letcli=
16+
Meow.make(
17+
{|
18+
Usage:
19+
$ retyped ...files
20+
21+
Examples:
22+
$ retyped file1.js file2.js file3.d.ts
23+
|},
24+
Meow.Config.config(
25+
~flags=
26+
Js.Dict.fromArray([|
27+
/*("debug", Meow.Flag.flag(~type_="boolean")),*/
28+
|]),
29+
),
30+
);
31+
32+
letdebugMode=
33+
cli|>Meow.CLI.flags|>Js.Dict.get(_,"debug")|> decodeBoolean;
34+
35+
letcompileFile= _file=>Js.Promise.resolve(true);
36+
37+
letcompileFile= files=>
38+
files
39+
|>Array.map(compileFile)
40+
|>Js.Promise.all
41+
|>Js.Promise.then_(results=> {
42+
letfilesWritten=
43+
results|>Js.Array.filter(s=> s==true)|>Js.Array.length;
44+
leterrorCount=
45+
results|>Js.Array.filter(s=> s==true)|>Js.Array.length;
46+
Js.Promise.resolve();
47+
});
48+
49+
Js.log(cli);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp