deno.land / x / yargs@v17.6.0-deno / test / fixtures / cmddir / deep / deeper / deeper_still / limbo.js
123456789101112131415161718192021222324252627282930313233343536/* eslint-disable no-undef */exports.command = 'limbo [opts]';exports.desc = 'Get lost in pure subconscious';exports.builder = { 'with-self-exit': { desc: 'Pretty much your only way out', type: 'boolean', }, 'with-totem': { desc: 'Take your totem with you', type: 'boolean', },};exports.handler = function (argv) { let factor = 3; if (!argv.withSelfExit) throw new Error('You entered limbo without a way out!'); if (!argv.withTotem) factor -= 2; if (argv.extract) { if (!chancesLevel4(factor)) throw new Error( "You didn't have much chance anyway, you're stuck in limbo!" ); if (!argv._msg) argv._msg = 'You have accomplished the impossible. Inception successful.'; return; } if (!chancesLevel4(factor)) throw new Error("You rolled the dice and lost, you're stuck in limbo!"); if (!argv._msg) argv._msg = "Can you ever be sure of what's real anymore?";};
function chancesLevel4(factor) { return Math.floor(Math.random() * 10) < factor;}
Version Info