rise-wallet 0.3.3-beta.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/bin/index.js
CHANGED
|
@@ -6,4 +6,4 @@ import{EventEmitter as e}from"events";function t(e){return e==null?[]:Array.isAr
|
|
|
6
6
|
`)}),i&&(a=i(a)||a),console.log(a.map(e=>e.title?`${e.title}:
|
|
7
7
|
${e.body}`:e.body).join(`
|
|
8
8
|
|
|
9
|
-
`))}outputVersion(){let{name:e}=this.cli,{versionNumber:t}=this.cli.globalCommand;t&&console.log(`${e}/${t} ${_}`)}checkRequiredArgs(){let e=this.args.filter(e=>e.required).length;if(this.cli.args.length<e)throw new m(`missing required args for command \`${this.rawName}\``)}checkUnknownOptions(){let{options:e,globalCommand:t}=this.cli;if(!this.config.allowUnknownOptions){for(let n of Object.keys(e))if(n!==`--`&&!this.hasOption(n)&&!t.hasOption(n))throw new m(`Unknown option \`${n.length>1?`--${n}`:`-${n}`}\``)}}checkOptionValue(){let{options:e,globalCommand:t}=this.cli,n=[...t.options,...this.options];for(let t of n){let r=e[t.name.split(`.`)[0]];if(t.required){let e=n.some(e=>e.negated&&e.names.includes(t.name));if(r===!0||r===!1&&!e)throw new m(`option \`${t.rawName}\` value is missing`)}}}},y=class extends v{constructor(e){super(`@@global@@`,``,{},e)}},b=Object.assign,x=class extends e{constructor(e=``){super(),this.name=e,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new y(this),this.globalCommand.usage(`<command> [options]`)}usage(e){return this.globalCommand.usage(e),this}command(e,t,n){let r=new v(e,t||``,n,this);return r.globalCommand=this.globalCommand,this.commands.push(r),r}option(e,t,n){return this.globalCommand.option(e,t,n),this}help(e){return this.globalCommand.option(`-h, --help`,`Display this message`),this.globalCommand.helpCallback=e,this.showHelpOnExit=!0,this}version(e,t=`-v, --version`){return this.globalCommand.version(e,t),this.showVersionOnExit=!0,this}example(e){return this.globalCommand.example(e),this}outputHelp(){this.matchedCommand?this.matchedCommand.outputHelp():this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:e,options:t},n,r){return this.args=e,this.options=t,n&&(this.matchedCommand=n),r&&(this.matchedCommandName=r),this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}parse(e=g,{run:t=!0}={}){this.rawArgs=e,this.name||=e[1]?f(e[1]):`cli`;let n=!0;for(let t of this.commands){let r=this.mri(e.slice(2),t),i=r.args[0];if(t.isMatched(i)){n=!1;let e=b(b({},r),{args:r.args.slice(1)});this.setParsedInfo(e,t,i),this.emit(`command:${i}`,t)}}if(n){for(let t of this.commands)if(t.name===``){n=!1;let r=this.mri(e.slice(2),t);this.setParsedInfo(r,t),this.emit(`command:!`,t)}}if(n){let t=this.mri(e.slice(2));this.setParsedInfo(t)}this.options.help&&this.showHelpOnExit&&(this.outputHelp(),t=!1,this.unsetMatchedCommand()),this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null&&(this.outputVersion(),t=!1,this.unsetMatchedCommand());let r={args:this.args,options:this.options};return t&&this.runMatchedCommand(),!this.matchedCommand&&this.args[0]&&this.emit(`command:*`),r}mri(e,t){let n=[...this.globalCommand.options,...t?t.options:[]],i=o(n),a=[],s=e.indexOf(`--`);s>-1&&(a=e.slice(s+1),e=e.slice(0,s));let c=r(e,i);c=Object.keys(c).reduce((e,t)=>b(b({},e),{[p(t)]:c[t]}),{_:[]});let l=c._,f={"--":a},m=t&&t.config.ignoreOptionDefaultValue?t.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,h=Object.create(null);for(let e of n){if(!m&&e.config.default!==void 0)for(let t of e.names)f[t]=e.config.default;Array.isArray(e.config.type)&&h[e.name]===void 0&&(h[e.name]=Object.create(null),h[e.name].shouldTransform=!0,h[e.name].transformFunction=e.config.type[0])}for(let e of Object.keys(c))e!==`_`&&(u(f,e.split(`.`),c[e]),d(f,h));return{args:l,options:f}}runMatchedCommand(){let{args:e,options:t,matchedCommand:n}=this;if(!n||!n.commandAction)return;n.checkUnknownOptions(),n.checkOptionValue(),n.checkRequiredArgs();let r=[];return n.args.forEach((t,n)=>{t.variadic?r.push(e.slice(n)):r.push(e[n])}),r.push(t),n.commandAction.apply(this,r)}};const S=(e=``)=>new x(e);var C=`0.3.3
|
|
9
|
+
`))}outputVersion(){let{name:e}=this.cli,{versionNumber:t}=this.cli.globalCommand;t&&console.log(`${e}/${t} ${_}`)}checkRequiredArgs(){let e=this.args.filter(e=>e.required).length;if(this.cli.args.length<e)throw new m(`missing required args for command \`${this.rawName}\``)}checkUnknownOptions(){let{options:e,globalCommand:t}=this.cli;if(!this.config.allowUnknownOptions){for(let n of Object.keys(e))if(n!==`--`&&!this.hasOption(n)&&!t.hasOption(n))throw new m(`Unknown option \`${n.length>1?`--${n}`:`-${n}`}\``)}}checkOptionValue(){let{options:e,globalCommand:t}=this.cli,n=[...t.options,...this.options];for(let t of n){let r=e[t.name.split(`.`)[0]];if(t.required){let e=n.some(e=>e.negated&&e.names.includes(t.name));if(r===!0||r===!1&&!e)throw new m(`option \`${t.rawName}\` value is missing`)}}}},y=class extends v{constructor(e){super(`@@global@@`,``,{},e)}},b=Object.assign,x=class extends e{constructor(e=``){super(),this.name=e,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new y(this),this.globalCommand.usage(`<command> [options]`)}usage(e){return this.globalCommand.usage(e),this}command(e,t,n){let r=new v(e,t||``,n,this);return r.globalCommand=this.globalCommand,this.commands.push(r),r}option(e,t,n){return this.globalCommand.option(e,t,n),this}help(e){return this.globalCommand.option(`-h, --help`,`Display this message`),this.globalCommand.helpCallback=e,this.showHelpOnExit=!0,this}version(e,t=`-v, --version`){return this.globalCommand.version(e,t),this.showVersionOnExit=!0,this}example(e){return this.globalCommand.example(e),this}outputHelp(){this.matchedCommand?this.matchedCommand.outputHelp():this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:e,options:t},n,r){return this.args=e,this.options=t,n&&(this.matchedCommand=n),r&&(this.matchedCommandName=r),this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}parse(e=g,{run:t=!0}={}){this.rawArgs=e,this.name||=e[1]?f(e[1]):`cli`;let n=!0;for(let t of this.commands){let r=this.mri(e.slice(2),t),i=r.args[0];if(t.isMatched(i)){n=!1;let e=b(b({},r),{args:r.args.slice(1)});this.setParsedInfo(e,t,i),this.emit(`command:${i}`,t)}}if(n){for(let t of this.commands)if(t.name===``){n=!1;let r=this.mri(e.slice(2),t);this.setParsedInfo(r,t),this.emit(`command:!`,t)}}if(n){let t=this.mri(e.slice(2));this.setParsedInfo(t)}this.options.help&&this.showHelpOnExit&&(this.outputHelp(),t=!1,this.unsetMatchedCommand()),this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null&&(this.outputVersion(),t=!1,this.unsetMatchedCommand());let r={args:this.args,options:this.options};return t&&this.runMatchedCommand(),!this.matchedCommand&&this.args[0]&&this.emit(`command:*`),r}mri(e,t){let n=[...this.globalCommand.options,...t?t.options:[]],i=o(n),a=[],s=e.indexOf(`--`);s>-1&&(a=e.slice(s+1),e=e.slice(0,s));let c=r(e,i);c=Object.keys(c).reduce((e,t)=>b(b({},e),{[p(t)]:c[t]}),{_:[]});let l=c._,f={"--":a},m=t&&t.config.ignoreOptionDefaultValue?t.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,h=Object.create(null);for(let e of n){if(!m&&e.config.default!==void 0)for(let t of e.names)f[t]=e.config.default;Array.isArray(e.config.type)&&h[e.name]===void 0&&(h[e.name]=Object.create(null),h[e.name].shouldTransform=!0,h[e.name].transformFunction=e.config.type[0])}for(let e of Object.keys(c))e!==`_`&&(u(f,e.split(`.`),c[e]),d(f,h));return{args:l,options:f}}runMatchedCommand(){let{args:e,options:t,matchedCommand:n}=this;if(!n||!n.commandAction)return;n.checkUnknownOptions(),n.checkOptionValue(),n.checkRequiredArgs();let r=[];return n.args.forEach((t,n)=>{t.variadic?r.push(e.slice(n)):r.push(e[n])}),r.push(t),n.commandAction.apply(this,r)}};const S=(e=``)=>new x(e);var C=`0.3.3`;const w=S(`porto`);w.command(`[root]`,`Display usage`).action(()=>{w.outputHelp(),process.exit(0)}),w.command(`onboard [alias: o]`,`Create a Porto Account`).alias(`o`).option(`-a, --admin-key`,`Create and provision an additional admin key for server access`,{default:!1}).option(`-d, --dialog <hostname>`,`Dialog hostname`,{default:`id.porto.sh`}).option(`-t, --testnet`,`Onboard via testnet`,{default:!1}).action(async(e,t)=>(await import(`./commands-B8imwW1l.js`)).createAccount(null,t)),w.help(),w.version(C),w.parse();export{};
|