{"_id":"@fluent/console","_rev":"27-6bf23cd49f9669e446d2e604873cf412","name":"@fluent/console","description":"Fluent - console component","dist-tags":{"latest":"1.0.8"},"versions":{"1.0.0":{"name":"@fluent/console","version":"1.0.0","description":"Fluent - console component","main":"build/index.js","typings":"build/index.d.ts","scripts":{"build":"tsc","prepublishOnly":"npm run build"},"keywords":["fluent","console"],"license":"MIT","author":{"name":"Eugen Melnychenko"},"dependencies":{"@fluent/core":"^1.0.0","@fluent/di":"^1.0.1","@fluent/logging":"^1.0.1","reflect-metadata":"^0.1.12"},"devDependencies":{"@types/node":"^9.3.0","typescript":"^2.6.2"},"_id":"@fluent/console@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.0","_npmUser":{"name":"emelnychenko","email":"eugen.melnychenko@gmail.com"},"dist":{"integrity":"sha512-5mH+CWTmb2o7GaLftczBe91K5/CxX8JdGuLVMpa9g6sds57mAg82AzoQVLbiLoPXXNP4Y60+yft+tH2alTTUSQ==","shasum":"4bfe5520cc19f0a705feac7f3d49bfc31492eec0","tarball":"https://registry.npmjs.org/@fluent/console/-/console-1.0.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCtCOXS3lJllAXwT+PWPzxWNnyK/s/mYd8tWz1OUPrmFAIgOQaGEXi1Ph4p1TJB/8xy3ioho4/D7cLR9ILhqecd6a4="}]},"maintainers":[{"name":"emelnychenko","email":"eugen.melnychenko@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/console-1.0.0.tgz_1516627908325_0.7523297690786421"},"deprecated":"Not maintained anymore","directories":{}},"1.0.1":{"name":"@fluent/console","version":"1.0.1","description":"Fluent - console component","main":"build/index.js","typings":"build/index.d.ts","scripts":{"build":"tsc","prepublishOnly":"npm run build"},"keywords":["fluent","console"],"repository":{"type":"git","url":"git+https://github.com/emelnychenko/fluent.git"},"license":"MIT","author":{"name":"Eugen Melnychenko"},"dependencies":{"reflect-metadata":"^0.1.12"},"peerDependencies":{"@fluent/core":"1.0.*","@fluent/di":"1.0.*","@fluent/logging":"1.0.*"},"devDependencies":{"@types/node":"^9.3.0","typescript":"2.6.*"},"bugs":{"url":"https://github.com/emelnychenko/fluent/issues"},"homepage":"https://github.com/emelnychenko/fluent#readme","_id":"@fluent/console@1.0.1","_npmVersion":"5.6.0","_nodeVersion":"8.9.0","_npmUser":{"name":"emelnychenko","email":"eugen.melnychenko@gmail.com"},"dist":{"integrity":"sha512-QZhNJwlJrJ4RyfuNdyx/CeP3BjlNb3/JRLHO+/wLQXf/DMBRq47HBCUwM2ijgCekshZSn3yKARrXyq+GU22Wrw==","shasum":"e3ad111a80507633f26d6d4d0e6501641ce6b100","tarball":"https://registry.npmjs.org/@fluent/console/-/console-1.0.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDXnXl3Oy+1aqA8w9Z8fgO0K88ttv3vxpXV1opFk5qitAIhAInJvHeA3rab3S8Wi3TgYthCN+yKNEOZA8q2Zldx+L8F"}]},"maintainers":[{"name":"emelnychenko","email":"eugen.melnychenko@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/console-1.0.1.tgz_1516825457877_0.5636573857627809"},"deprecated":"Not maintained anymore","directories":{}},"1.0.5":{"name":"@fluent/console","version":"1.0.5","description":"Fluent - console component","main":"build/index.js","typings":"build/index.d.ts","scripts":{"build":"tsc","prepublishOnly":"npm run build"},"keywords":["fluent","console"],"repository":{"type":"git","url":"git+https://github.com/emelnychenko/fluent.git"},"license":"MIT","author":{"name":"Eugen Melnychenko"},"dependencies":{"reflect-metadata":"^0.1.12"},"peerDependencies":{"@fluent/core":"^1.0.5","@fluent/di":"^1.0.5","@fluent/logging":"^1.0.5"},"devDependencies":{"@types/node":"^9.3.0","typescript":"2.6.*"},"bugs":{"url":"https://github.com/emelnychenko/fluent/issues"},"homepage":"https://github.com/emelnychenko/fluent#readme","_id":"@fluent/console@1.0.5","_npmVersion":"5.6.0","_nodeVersion":"8.9.0","_npmUser":{"name":"emelnychenko","email":"eugen.melnychenko@gmail.com"},"dist":{"integrity":"sha512-lixxh4d7FSq+qt4FqBx8H94I9Fq+puTZlK9E4aETe8I2WXnwSKCrI3aY2CRe7/JP+Hyz9+gsuoP9Wapiy0Lj3g==","shasum":"787f44773af7c681436611a17b102957224c7054","tarball":"https://registry.npmjs.org/@fluent/console/-/console-1.0.5.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBLTT/e0qlcC6F2ZnqID2AUS7TW/NrjbJnMVKjGzpXv3AiBoBIHHcr+oOyn28PgXWfawdrHntdw5jaZ3wvr/jbeQ6g=="}]},"maintainers":[{"name":"emelnychenko","email":"eugen.melnychenko@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/console-1.0.5.tgz_1516971761651_0.11949901608750224"},"deprecated":"Not maintained anymore","directories":{}},"1.0.8":{"name":"@fluent/console","version":"1.0.8","description":"Fluent - console component","main":"build/index.js","typings":"types/index.d.ts","scripts":{"build":"tsc","prepublishOnly":"npm run build","pretest":"npm run-script build","test":"mocha --exit build/**/*.spec.js"},"keywords":["fluent","console"],"repository":{"type":"git","url":"git+https://github.com/emelnychenko/fluent.git"},"license":"MIT","author":{"name":"Eugen Melnychenko"},"dependencies":{"reflect-metadata":"0.1.*"},"peerDependencies":{"@fluent/di":"1.0.8","@fluent/reflect":"1.0.8"},"devDependencies":{"@types/chai":"^4.1.2","@types/node":"^9.3.0","chai":"^4.1.2","@types/mocha":"^2.2.47","mocha":"^5.0.0","typescript":"2.6.*"},"bugs":{"url":"https://github.com/emelnychenko/fluent/issues"},"homepage":"https://github.com/emelnychenko/fluent#readme","_id":"@fluent/console@1.0.8","_npmVersion":"5.6.0","_nodeVersion":"8.9.0","_npmUser":{"name":"emelnychenko","email":"eugen.melnychenko@gmail.com"},"dist":{"integrity":"sha512-54suZjGIfdO8BwAUk1Vt9yCu0KVz7rZV7XbP8r3pzdYJ6VU2CfJsvRWkSPKffjwkjxycnK+9q9olCu5tPSU5kw==","shasum":"c3c1da02d180404df602fb7f86a40a52440baae4","tarball":"https://registry.npmjs.org/@fluent/console/-/console-1.0.8.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC8Qdb64gKDZ1zB/sUGH7XkaSATgPGm3gobsc8vF7F0WQIhAOMPtstLJwx0bpf1om8kBPIa23FyK/WnJCahuo6uJy5d"}]},"maintainers":[{"name":"emelnychenko","email":"eugen.melnychenko@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/console-1.0.8.tgz_1517699131843_0.524397706380114"},"directories":{},"deprecated":"Not maintained anymore"}},"readme":"# Console\n\nThe command line interface is the basis for application execution. The console operates with commands. That's how the command looks:\n\n```typescript\n@Command('ping')\nexport class PingCommand extends CommandHandler {\n  constructor(readonly logger: Logger) {\n    super();\n  }\n\n  async handle() {\n    this.logger.information('pong');\n  }\n}\n```\n\n`@Command(string)` is required. This decorator sets the template and allows you to inject the services on the constructor.\n\nIn order to add the command you need to register it in the application:\n\n```typescript\n@Main()\nexport class Startup {\n  configure(app: ApplicationBuilder) {\n    app.addCommand(PingCommand);\n  }\n}\n```\n\n## Template Definition\n\nThe command template consists of three components: name, arguments and options. These components should be separated by a space.\n\n### Name\n\nThe name is required and must be unique:\n\n```typescript\n@Command('ping')\n```\n\n### Argument\n\nArguments can be several or none.\n\nHere is an example of an required argument:\n\n```typescript\n@Command('ping {message}')\n```\n\nThe argument may also be optional and contain default value:\n\n```typescript\n@Command('ping {message?}')\n\n// and with default value\n\n@Command('ping {message=pong}')\n```\n\n### Option\n\nOptions can be several or none as well. Option always will be optional and can be defined as string or boolean type.\n\nHere is an example of option:\n\n```typescript\n@Command('ping {--log}')\n```\n\nOption can have multi-definition:\n\n```typescript\n@Command('ping {-l|--log}')\n```\n\nIf the option is not specified then the value will be `false`;\n\nThat's how the option with value looks:\n\n```typescript\n@Command('ping {--message=}')\n\n// or with default value\n\n@Command('ping {--message=pong}')\n```\n\nIf the option is not specified then the value will be `undefined`;\n\nOption can receive array value:\n\n```typescript\n// ping --to=foo --to=bar\n\n@Command('ping {--to=*}')\n```\n\nIf the option is not specified then the value will be `[]`;\n\n## Command Handler\n\nthe handler of the commands can receive parets through the decorators: `@Argument()` and `@Option()`\n\n```typescript\n@Command('ping {message=pong} {--log}')\nexport class PingCommand extends CommandHandler {\n  constructor(readonly logger: Logger) {\n    super();\n  }\n\n  async handle(@Argument() message: string, @Option() log: boolean) {\n    if (log) {\n      this.logger.information(message);\n    }\n  }\n}\n```\n\nIn this case, the name of the argument and options are the name of the parameters. They can also be redefined:\n\n```typescript\nasync handle(@Argument('message') msg: string, @Option('--log') log: boolean) {\n    if (log) {\n      this.logger.information(message);\n    }\n  }\n```\n\n## Command Execution\n\nIn order to execute the command you need to compile the code and enter:\n\n```bash\nnode main.js \"command template\"\n```\n\nExample of `PingCommand`:\n\n```bash\nnode main.js ping pong --log\n```\n\nOutput will looks:\n\n```bash\ninformation: pong\n```","maintainers":[{"email":"eemeli@gmail.com","name":"eemeli"},{"email":"zibi@braniecki.net","name":"zbraniecki"},{"email":"tatum.creative@gmail.com","name":"tatumcreative"},{"email":"flod@mozilla.com","name":"flod"}],"time":{"modified":"2022-04-05T11:25:09.109Z","created":"2018-01-22T13:31:49.211Z","1.0.0":"2018-01-22T13:31:49.211Z","1.0.1":"2018-01-24T20:24:18.890Z","1.0.2":"2018-01-25T13:26:18.840Z","1.0.5":"2018-01-26T13:02:42.576Z","1.0.6":"2018-02-03T20:14:53.570Z","1.0.7":"2018-02-03T20:27:07.133Z","1.0.8":"2018-02-03T23:05:31.965Z"},"keywords":["fluent","console"],"author":{"name":"Eugen Melnychenko"},"license":"MIT","readmeFilename":"README.md","homepage":"https://github.com/emelnychenko/fluent#readme","repository":{"type":"git","url":"git+https://github.com/emelnychenko/fluent.git"},"bugs":{"url":"https://github.com/emelnychenko/fluent/issues"}}