All files / lib default-options.js

100% Statements 7/7
100% Branches 0/0
100% Functions 0/0
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 745x 5x 5x                                                 5x                                                             5x               5x           5x  
const enUs = require('./templates/help/en-us')
const meow = require('meow')
const restClientOptions = require('./rest-client-options')
 
/*
 * Const loadOptions = cli => {
 *   const OWNER = 1
 *   const REPO = 2
 *   const segs = new URL(cli.pkg.repository.url).pathname
 *     .replace(cli.baseUrl, '')
 *     .split('/')
 *   restClientOptions.owner = segs[OWNER]
 *   restClientOptions.repo = segs[REPO].replace('.git', '')
 */
 
/*
 *   Return Object.assign(defaultOptions, restClientOptions, {
 *     baseUrl: cli.baseUrl,
 *     dest: cli.flags.dest,
 *     noAutoFilename: cli.flags.noAutoFilename,
 *     owner: cli.flags.owner,
 *     repo: cli.flags.repo,
 *     resourceType: cli.flags.resourceType
 *   })
 * }
 */
 
const cliOptions = {
  'flags': {
    'baseUrl': {
      'default': 'https://api.github.com',
      'type': 'string'
    },
    'dest': {
      'alias': 'd',
      'default': `./export.csv`,
      'type': 'string'
    },
    'no-auto-filename': {
      'default': false,
      'type': 'boolean'
    },
    'owner': {
      'alias': 'o',
      'type': 'string'
    },
    'repo': {
      'alias': 'r',
      'type': 'string'
    },
    'resource-type': {
      'alias': 't',
      'default': 'issues',
      'type': 'string'
    }
  }
}
 
const meta = meow(enUs.help, cliOptions)
 
/**
 * Input options, especillay for the CLI.
 * @type {object}
 * @memberOf {grc}
 */
 
const defaultOptions = {
  'api': restClientOptions,
  'cli': cliOptions,
  meta
}
 
module.exports = defaultOptions