当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript os.type函数代码示例

本文整理汇总了TypeScript中os.type函数的典型用法代码示例。如果您正苦于以下问题:TypeScript type函数的具体用法?TypeScript type怎么用?TypeScript type使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了type函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: getUserHomePath

    public static getUserHomePath(): string {
        let homeDirectory: string = "";

        if (os.type() === "Darwin") {
            homeDirectory = process.env.HOME;
        } else if (os.type() === "Windows_NT") {
            homeDirectory = process.env.USERPROFILE;
        }

        return homeDirectory;
    }
开发者ID:ajwhite,项目名称:vscode-react-native,代码行数:11,代码来源:intellisenseHelper.ts

示例2: getTerminalCommand

function getTerminalCommand() {
  if (os.type() === 'Windows_NT') {
    return 'start %s'
  } else if (os.type() === 'Linux') {
    return `x-terminal-emulator -e "bash -c \\"%s\\""`
  } else if (os.type() === 'Darwin') {
    return `osascript -e 'tell app "Terminal" to do script "%s"'`
  } else {
    // not recognised, hope xterm works
    return `xterm -e "bash -c \\"%s\\""`
  }
}
开发者ID:ThomasHickman,项目名称:haskell-debug,代码行数:12,代码来源:config.ts

示例3: getExecutableExtention

function getExecutableExtention(): string {
    if(os.type().match(/^Win/)){
        return ".exe";
    }

    return "";
}
开发者ID:bleissem,项目名称:vsts-tasks,代码行数:7,代码来源:kubectlutility.ts

示例4: machineId

 return machineId().catch(() => {
   // In case MachineId fails
   const hash = crypto.createHash('sha256')
   const network = os.networkInterfaces()
   hash.update(os.arch() + os.hostname() + os.platform() + os.type() + network['mac'])
   return hash.digest('hex')
 })
开发者ID:alexsandrocruz,项目名称:botpress,代码行数:7,代码来源:stats.ts

示例5: getExecutableExtension

function getExecutableExtension(): string {
    if (os.type().match(/^Win/)) {
        return '.exe';
    }

     return '';
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:7,代码来源:duffleinstaller.ts

示例6: enableSalsa

    /**
     * Helper method that sets the environment variable and informs the user they need to restart
     * in order to enable the Salsa intellisense.
     */
    public static enableSalsa(isRestartRequired: boolean): Q.Promise<boolean> {
        if (!process.env.VSCODE_TSJS) {
            let setEnvironmentVariableCommand: string = "";
            if (os.type() === "Darwin") {
                setEnvironmentVariableCommand = "launchctl setenv VSCODE_TSJS 1";
            } else if (os.type() === "Windows") {
                setEnvironmentVariableCommand = "setx VSCODE_TSJS 1";
            }

            return Q({})
                .then(() => Q.nfcall(child_process.exec, setEnvironmentVariableCommand))
                .then(() => { return true; });
        }

        return Q(isRestartRequired);
    }
开发者ID:ajwhite,项目名称:vscode-react-native,代码行数:20,代码来源:intellisenseHelper.ts

示例7: handleError

export function handleError (error: Error, options: PrintOptions): any {
  let cause = (error as any).cause

  logError(error.message, 'message')

  while (cause) {
    logError(cause.message, 'caused by')

    cause = (cause as any).cause
  }

  if (options.verbose && error.stack) {
    log('')
    logError(error.stack, 'stack')
  }

  log('')
  logError(process.cwd(), 'cwd')
  logError(`${os.type()} ${os.release()}`, 'system')
  logError(process.argv.map(JSON.stringify).join(' '), 'command')
  logError(process.version, 'node -v')
  logError(pkg.version, `typings -v`)

  if ((error as any).code) {
    logError((error as any).code, 'code')
  }

  log('')
  logError('If you need help, you may report this error at:')
  logError(`  <https://github.com/typings/typings/issues>`)

  process.exit(1)
}
开发者ID:AndreiShostik,项目名称:typings,代码行数:33,代码来源:cli.ts

示例8: handleError

export function handleError (error: BaseError, options: PrintOptions): any {
  let message = ''
  let cause = error

  message += logError(error.message, 'message')

  while (cause = cause.cause as any) {
    message += logError(cause.message, 'caused by')
  }

  if (options.verbose && error.stack) {
    message += '\n'
    message += logError(error.stack, 'stack')
  }

  message += '\n'
  message += logError(process.cwd(), 'cwd')
  message += logError(`${os.type()} ${os.release()}`, 'system')
  message += logError(process.argv.map(JSON.stringify).join(' '), 'command')
  message += logError(process.version, 'node -v')
  message += logError(pkg.version, `${PROJECT_NAME} -v`)

  if ((error as any).code) {
    message += logError((error as any).code, 'code')
  }

  message += '\n'
  message += logError('If you need help, you may report this error at:')
  message += logError(`  <${ISSUES_HOMEPAGE}>`)

  console.error(message)
  process.exit(1)
}
开发者ID:bitjson,项目名称:typings,代码行数:33,代码来源:cli.ts

示例9: downloadBinary

 /**
  * Download the binary file.
  * @param binary The binary of interest.
  * @param outputDir The directory where files are downloaded and stored.
  * @param opt_proxy The proxy for downloading files.
  * @param opt_ignoreSSL To ignore SSL.
  * @param opt_callback Callback method to be executed after the file is downloaded.
  */
 static downloadBinary(
     binary: Binary, outputDir: string, opt_proxy?: string,
     opt_ignoreSSL?: boolean, opt_callback?: Function): void {
   logger.info(binary.name + ': downloading version ' + binary.version());
   var url = binary.url(os.type(), os.arch());
   if (!url) {
     logger.error(binary.name + ' v' + binary.version() + ' is not available for your system.');
     return;
   }
   Downloader.httpGetFile_(
       url, binary.filename(os.type(), os.arch()), outputDir, opt_proxy, opt_ignoreSSL, (filePath: string) => {
         if (opt_callback) {
           opt_callback(binary, outputDir, filePath);
         }
       });
 }
开发者ID:rayrapetyan,项目名称:webdriver-manager,代码行数:24,代码来源:downloader.ts

示例10: env

export function env(): any {
    let env = Object.assign({}, process.env);

    if (os.type() == 'Darwin') {
        env.PATH = `${ROOT}/bin:${env.PATH}`;
    } else if (os.type() == 'Linux') {
        if (os.arch() == 'x64') {

        } else {

        }
    } else if (os.type() == 'Windows_NT') {
        env.Path =  `${ROOT}/bin;${env.Path}`;
    }

    return env;
}
开发者ID:Romakita,项目名称:e2e-app,代码行数:17,代码来源:env.ts


注:本文中的os.type函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。