Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

helpers.js 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. 'use strict'
  2. const decamelize = require('decamelize')
  3. const schema = require('@istanbuljs/schema')
  4. /* These options still need to be connected to the instrumenter
  5. * Disabling them for now also avoids the issue with OSX cutting
  6. * off the error help screen at 8192 characters.
  7. */
  8. const blockOptions = [
  9. 'coverageVariable',
  10. 'coverageGlobalScope',
  11. 'coverageGlobalScopeFunc'
  12. ]
  13. module.exports = {
  14. setupOptions (yargs, command, cwd) {
  15. Object.entries(schema.nyc.properties).forEach(([name, setup]) => {
  16. if (blockOptions.includes(name)) {
  17. return
  18. }
  19. const option = {
  20. description: setup.description,
  21. default: setup.default,
  22. type: setup.type
  23. }
  24. if (name === 'cwd') {
  25. if (command !== null) {
  26. return
  27. }
  28. option.default = cwd
  29. option.global = true
  30. }
  31. if (option.type === 'array') {
  32. option.type = 'string'
  33. }
  34. if ('nycAlias' in setup) {
  35. option.alias = setup.nycAlias
  36. }
  37. const optionName = decamelize(name, '-')
  38. yargs.option(optionName, option)
  39. if (!setup.nycCommands.includes(command)) {
  40. yargs.hide(optionName)
  41. }
  42. })
  43. },
  44. /* istanbul ignore next: unsure how to test this */
  45. suppressEPIPE (error) {
  46. /* Prevent dumping error when `nyc npm t|head` causes stdout to
  47. * be closed when reporting runs. */
  48. if (error.code !== 'EPIPE') {
  49. throw error
  50. }
  51. },
  52. cliWrapper (execute) {
  53. return argv => {
  54. execute(argv).catch(error => {
  55. try {
  56. console.error(error.message)
  57. } catch (_) {
  58. /* We need to run process.exit(1) even if stderr is destroyed */
  59. }
  60. process.exit(1)
  61. })
  62. }
  63. }
  64. }