-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCLA.ts
More file actions
34 lines (31 loc) · 923 Bytes
/
CLA.ts
File metadata and controls
34 lines (31 loc) · 923 Bytes
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
import config from "./config.js";
import { parse } from "https://deno.land/std/flags/mod.ts";
const args: any = parse(Deno.args);
/**
* Gets the model folder from the command line or defaults to the one specified in the config.js file
*/
export function modelsFolder(): string {
if ("m" in args) {
return args["m"].endsWith("/")
? replaceAt(args["m"], args["m"].length - 1, "")
: args["m"];
}
return config.models_folder;
}
/**
* The mode to print data
*/
export function printMode(): string {
return "p" in args ? args["p"] : config.print_mode;
}
/**
* Name says it all..
* Credits to : https://gist.github.com/efenacigiray/9367920
* @author https://github.com/efenacigiray
* @param string
* @param index
* @param replace
*/
function replaceAt(string: string, index: number, replace: string): string {
return string.substring(0, index) + replace + string.substring(index + 1);
}