{"id":17652393,"url":"https://github.com/bashleigh/kli","last_synced_at":"2026-01-20T07:02:05.954Z","repository":{"id":224529051,"uuid":"763489775","full_name":"bashleigh/kli","owner":"bashleigh","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-27T09:30:03.000Z","size":76,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-07T03:48:42.514Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bashleigh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-26T11:51:06.000Z","updated_at":"2024-02-26T20:10:28.000Z","dependencies_parsed_at":"2024-02-26T13:29:27.383Z","dependency_job_id":"636ca243-d6df-4209-b2bd-9f8502d5eba5","html_url":"https://github.com/bashleigh/kli","commit_stats":null,"previous_names":["bashleigh/kli"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bashleigh/kli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bashleigh%2Fkli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bashleigh%2Fkli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bashleigh%2Fkli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bashleigh%2Fkli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bashleigh","download_url":"https://codeload.github.com/bashleigh/kli/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bashleigh%2Fkli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28597985,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T02:08:49.799Z","status":"ssl_error","status_checked_at":"2026-01-20T02:08:44.148Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-23T11:46:44.727Z","updated_at":"2026-01-20T07:02:05.918Z","avatar_url":"https://github.com/bashleigh.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# General Grievous\n\nA TypeScript based command line interface framework. Designed to make creating cli tools simple.\n\n## Install\n\n\u003e Not available yet\n## Usage\n\n```ts\nimport { Command, Arg, Grievous } from 'grievous'\n\n@Command({\n  name: 'test',\n  description: 'My example command called test',\n})\nclass TestCommand extends AbstractCommand {\n  run(\n    @Arg({\n      name: 'arg1',\n      description: 'testing arg1',\n    })\n    arg1: any,\n  ) {\n    console.log('arg1', arg1)\n  }\n}\n\nconst general = new Grievous()\n\ngeneral.run({\n  commandName: 'my-command-name',\n  commands: [ TestCommand ],\n})\n\n```\n\ncall it like this\n\n```bash\n$ ts-node src/index.ts test --arg1 my-arg\n```\n\u003e replace `ts-node src/index.ts` with a bin file or main file and you can use that\n\n## Global help \n\nThe commands and args decorators have strict properties for descriptions and names. These are used to generate help outputs automatically for all command or specific commands and or their children.\n\n```bash\n$ ts-node src/index.ts --help\n```\nThe above will print out all help info about all commands within the container\n\n```bash\n$ ts-node src/index.ts my-command --help\n```\nThe above will print out the help info about the specific `my-command` command and it's children if any\n\n```bash\n$ ts-node src/index.ts my-command child --help\n```\nThe above will print out the help info for the specific `child` command within `my-command`\n\n## Command Decorator\n\n```ts\n@Command({\n  name: 'command-name' // the sub command name for this defined command\n  description: 'My Command does this cool thing', // the description used for help of this particular command\n  children: [], // An array of child commands for chaining such as command-name sub-command, sub-command's class with be defined here\n})\n```\n\n## Arg Decorator\n```ts\n @Arg({\n  name: 'arg1', // The give name of the arg, used as --arg1 on the command line\n  description: 'testing arg1', // The description of the arg, used for help output of this particular command\n  type: 'string', // The type, not required, only used for boolean types\n  required: false, // If required, throw an exception message to user and prevent calling\n  default: 'test', // If provided, this will be inputed if --arg1 is not provided\n  alias: 'a', // Shorthand name for the argument\n})\n```\n\n## Boostrapping\n\nYou will need to provide all commands and desired injectable classes into the grievous.run func.\n\n```ts\nconst general = new Grievous()\n\ngeneral.run({\n  commandName: 'my-command-name',\n  providers: [\n    MySharedProvider,\n  ],\n  commands: [\n    TestCommand,\n  ],\n})\n```\n\n## Global config\n\nThe global config object can be obtained within the run function as it's injected into the instantiated command\n\n```ts\n@Command({\n  name: 'myCommand',\n  desciption: 'example of global config usage',\n})\nclass MyCommand extends AbstractCommand {\n  async run() {\n    if (this.globalConfig.dev) this.writeLn('I am in dev mode')\n  }\n}\n```\n\n## Sub (children) commands\n\nThese are commands that are chainable from a given parent command\n\n```ts\n\n@Command({\n  name: 'child',\n  description: 'The child command',\n})\nclass ChildCommand extends AbstractCommand {}\n\n@Command({\n  name: 'parent',\n  description: 'The parent command',\n  children: [ ChildCommand ],\n})\nclass ParentCommand extends AbstractCommand {}\n\n```\nIn order to call the child command, you can do so like this \n\n```bash\n$ ts-node src/index.ts parent child\n```\n\nFor the children to be found, they will need to be added to the commands property within the grievous.run function\n\n```ts\ngeneral.run({\n  commandName: 'my-command-name',\n  commands: [ ParentCommand, ChildCommand ],\n})\n```\n\n## Providers \n\nProviders are classes or token based values that are sotred within the container and injected within commands\n\n```ts\nclass MyProvider {\n\n}\n\n@Command({\n  name: 'mycommand',\n  description: 'My Command exampling how to inject custom providers',\n})\nclass MyCommand extends AbstractCommand {\n  constructor(\n    @Inject('GlobalConfig') globalConfig: GobalConfig,\n    private readonly myProvider: MyProvider,\n  ) {\n    super(globalConfig)\n  }\n}\n\ngeneral.run({\n  commandName: 'my-command-name',\n  providers: [ MyProvider ],\n  commands: [ MyCommand ],\n})\n\n```\n\n#### Using values as providers\n\n```ts\ngeneral.run({\n  commandName: 'my-command-name',\n  providers: [{\n    token: 'my-custom-provider',\n    value: {\n      myStoredProperty: 'myStoredValue',\n    },\n  }],\n  commands: [ MyCommand ],\n})\n```\n\nCan then be injected within providers or commands\n\n```ts\nclass MyProvider {\n  constructor(\n    @Inject('my-custom-provider') private readonly customProvider: { myStoredProperty: sting },\n  ) {}\n}\n\n\n@Command({\n  name: 'mycommand',\n  description: 'My Command exampling how to inject custom providers',\n})\nclass MyCommand extends AbstractCommand {\n  constructor(\n    @Inject('GlobalConfig') globalConfig: GobalConfig,\n    @Inject('my-custom-provider') private readonly customProvider: { myStoredProperty: sting },\n  ) {\n    super(globalConfig)\n  }\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbashleigh%2Fkli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbashleigh%2Fkli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbashleigh%2Fkli/lists"}