ニジカ投稿局 https://tv.nizika.tv
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.
 
 
 
 
 

31 lines
718 B

  1. import prompt from 'prompt'
  2. export async function askConfirmation (message: string) {
  3. return new Promise((res, rej) => {
  4. prompt.start()
  5. const schema = {
  6. properties: {
  7. confirm: {
  8. type: 'string',
  9. description: message + ' (y/n)',
  10. default: 'n',
  11. validator: /y[es]*|n[o]?/,
  12. warning: 'Must respond yes or no',
  13. required: true
  14. }
  15. }
  16. }
  17. prompt.get(schema, function (err, result) {
  18. if (err) return rej(err)
  19. return res(result.confirm?.match(/y/) !== null)
  20. })
  21. })
  22. }
  23. export function displayPeerTubeMustBeStoppedWarning () {
  24. console.log(`/!\\ PeerTube must be stopped before running this script /!\\\n`)
  25. }