本文整理匯總了TypeScript中Process.argv.slice方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript argv.slice方法的具體用法?TypeScript argv.slice怎麽用?TypeScript argv.slice使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Process.argv
的用法示例。
在下文中一共展示了argv.slice方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
import * as lsp from 'vscode-languageserver-protocol'
import * as lspt from 'vscode-languageserver-types'
import {Position} from 'vscode-languageserver-types'
import * as rpc from 'vscode-jsonrpc'
import * as fs from 'fs'
import * as path from 'path'
import * as cp from 'child_process'
import * as process from 'process'
import * as libkak from './libkak'
import {Splice, subkeys, Kak} from './libkak'
import * as util from 'util'
util.inspect.defaultOptions.depth = 5
const session = process.argv[2]
const server = process.argv[3]
const proto_args = process.argv.slice(4)
const args = proto_args.filter(arg => arg != '-d')
const debug = proto_args.some(arg => arg == '-d')
const debug_values = debug
const debug_out = debug
const debug_to_kakoune = debug
const debug_connection = debug
if (!session || !server) {
console.error(`Need two arguments:
<kak session>
<server command>
Example:
示例2: require
const maxOldSpaceSizeArg = process.execArgv.find(arg =>
arg.includes("--max_old_space_size")
);
const inspectArg = process.execArgv.find(arg => arg.includes("--inspect"));
if (!maxOldSpaceSizeArg) {
// Analysis etc can sometimes use lots of memory, so raise the memory threshold
const fork = require("child_process").fork;
const execArgv = process.execArgv;
execArgv.push("--max_old_space_size=8000");
if (inspectArg) {
// set new port because otherwise it'll say port already in use
execArgv.push("--inspect=36689");
}
const childWithMoreMemory = fork(process.argv[1], process.argv.slice(2), {
execArgv
});
childWithMoreMemory.on("exit", function() {
process.exit();
});
process["titl" + "e"] =
"FromJS (launched CLI process with too low memory limit)";
} else {
commander
.option("--openBrowser <shouldOpen>", "yes|no|only", "yes")
.option("-p, --port <port>", "Server port", 7000)
.option(
"-s, --sessionDirectory <sessionDirectory>",
"Where to store tracking data",
"fromjs-session"