- .option('-g, --gui <player>', 'player type', /^(airplay|stdout|chromecast|mpv|vlc|mplayer|ascii|xbmc)$/i, 'ascii')
- .option('-i, --invert', 'invert colors (ascii player only)', true)
- .option('-r, --resolution <res>', 'video resolution', /^(240|360|720|1080)$/i, '720')
- .on('--help', function () {
- console.log(' Available Players:')
- console.log()
- console.log(' - ascii')
- console.log(' - mpv')
- console.log(' - mplayer')
- console.log(' - vlc')
- console.log(' - stdout')
- console.log(' - xbmc')
- console.log(' - airplay')
- console.log(' - chromecast')
- console.log()
- console.log(' Note: \'ascii\' is the only option not using WebTorrent and not seeding back the video.')
- console.log()
- console.log(' Examples:')
- console.log()
- console.log(' $ peertube watch -g mpv https://peertube.cpy.re/videos/watch/e8a1af4e-414a-4d58-bfe6-2146eed06d10')
- console.log(' $ peertube watch --gui stdout https://peertube.cpy.re/videos/watch/e8a1af4e-414a-4d58-bfe6-2146eed06d10')
- console.log(' $ peertube watch https://peertube.cpy.re/videos/watch/e8a1af4e-414a-4d58-bfe6-2146eed06d10')
- console.log()
- })
- .action((url) => {
- videoURL = url
- })
+ .addOption(
+ new program.Option('-g, --gui <player>', 'player type')
+ .default('vlc')
+ .choices([ 'airplay', 'stdout', 'chromecast', 'mpv', 'vlc', 'mplayer', 'xbmc' ])
+ )
+ .option('-r, --resolution <res>', 'video resolution', '480')
+ .addHelpText('after', '\n\n Examples:\n\n' +
+ ' $ peertube watch -g mpv https://peertube.cpy.re/videos/watch/e8a1af4e-414a-4d58-bfe6-2146eed06d10\n' +
+ ' $ peertube watch --gui stdout https://peertube.cpy.re/videos/watch/e8a1af4e-414a-4d58-bfe6-2146eed06d10\n' +
+ ' $ peertube watch https://peertube.cpy.re/videos/watch/e8a1af4e-414a-4d58-bfe6-2146eed06d10\n'
+ )
+ .action((url, options) => run(url, options))