-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathOpenSSL.hx
37 lines (30 loc) · 1.02 KB
/
OpenSSL.hx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
* SPDX-FileCopyrightText: © Sebastian Thomschke and contributors
* SPDX-FileContributor: Sebastian Thomschke
* SPDX-License-Identifier: MIT
* SPDX-ArtifactOfProjectHomePage: https://github.com/sebthom/more-clink-completions
*/
package more_clink_completions.completions;
import clink.util.LuaArray;
import clink.api.ArgMatcher;
import clink.api.Clink;
import more_clink_completions.util.Utils;
using clink.util.Strings;
class OpenSSL {
public static function register() {
if (Clink.getArgMatcher("openssl") == null)
Clink.argMatcher("openssl").setDelayedInitializer(registerNow);
}
static function registerNow(parser:ArgMatcher, commandWord:String) {
parser.addArg(suggestCommands);
}
static function suggestCommands():LuaArray<String> {
final commands = new LuaArray<String>();
for (line in Utils.exec('cmd /C "openssl help 2>&1"')) {
for (command in line.findMatches("[a-zA-Z0-9-_]+")) {
commands.add(command);
}
}
return commands;
}
}