cbd2d1bbe95432726c895d2cf59c49fc9be7bf24e0e773c3a4287d708ad4e36fd7b7a77be4b3dae2e205ea52b65ad883ac77539df0e5eec637f67e9bb799eb 486 B

12345678910111213141516
  1. const launch = require('launch-editor')
  2. exports.launch = (...args) => {
  3. const file = args[0]
  4. console.log(`Opening ${file}...`)
  5. let cb = args[args.length - 1]
  6. if (typeof cb !== 'function') {
  7. cb = null
  8. }
  9. launch(...args, (fileName, errorMessage) => {
  10. console.error(`Unable to open '${fileName}'`, errorMessage)
  11. console.log(`Try setting the EDITOR env variable. More info: https://github.com/yyx990803/launch-editor`)
  12. if (cb) cb(fileName, errorMessage)
  13. })
  14. }