deno.land / x / yargs@v17.6.0-deno / test / fixtures / cmddir / deep / deeper / deeper_still / limbo.js

نووسراو ببینە
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
/* 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;}
yargs

Version Info

Tagged at
2 years ago