{"id":15386380,"url":"https://github.com/h-a-n-a/pero","last_synced_at":"2025-04-15T19:53:21.037Z","repository":{"id":48079834,"uuid":"384464430","full_name":"h-a-n-a/pero","owner":"h-a-n-a","description":"😗 Easy to use route-based tool for building large-scale command-line interfaces","archived":false,"fork":false,"pushed_at":"2021-08-08T09:54:23.000Z","size":65,"stargazers_count":16,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-19T16:24:58.092Z","etag":null,"topics":["cli","command-line","node","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/h-a-n-a.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-09T14:37:10.000Z","updated_at":"2021-11-21T20:33:28.000Z","dependencies_parsed_at":"2022-08-12T18:10:33.778Z","dependency_job_id":null,"html_url":"https://github.com/h-a-n-a/pero","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h-a-n-a%2Fpero","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h-a-n-a%2Fpero/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h-a-n-a%2Fpero/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h-a-n-a%2Fpero/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/h-a-n-a","download_url":"https://codeload.github.com/h-a-n-a/pero/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234834119,"owners_count":18893999,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cli","command-line","node","typescript"],"created_at":"2024-10-01T14:49:06.631Z","updated_at":"2025-01-20T18:20:48.677Z","avatar_url":"https://github.com/h-a-n-a.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"https://i.loli.net/2021/08/02/pCDoP8GVJH42XdB.png\" alt=\"pero logo\" width=\"150\"\u003e\u003c/p\u003e\n\u003ch1 align=\"center\"\u003ePero\u003c/h1\u003e\n\u003cp align=\"center\"\u003eRoute based CLI tool for creating large scale command line interfaces.\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/h-a-n-a/pero/actions\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/workflow/status/h-a-n-a/pero/ci.svg\" alt=\"Build Status\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://npmjs.com/package/pero\"\u003e\n        \u003cimg src=\"https://img.shields.io/npm/v/pero.svg\" alt=\"npm-v\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\n## Why?\n\nNowadays, we have commander.js and all the other cli tools to choose, but why we build **yet another cli tool** ? \n\nIn the real-world scenario, nested commands are so popular among large-scale projects. Pero is trying to solve this problem and also bring you with the progressive TypeScript support. \n\n\n## Feature\n\n- Route based, born to create nested CLI commands\n- ESBuild driven, really fast to compile your CLI project\n\n## Quick Tour\n\n**This project is under heavy development, APIs might be changed until the stable version is released. [📍Roadmap](https://github.com/h-a-n-a/pero/issues/1)**\n\n### 1. Install\n\n```bash\nnpm install pero --save\n# or use\nyarn add pero\n```\n\n\n### 2. Create a folder for CLI\n\n```bash\nmkdir src\ncd $_ \ntouch index.ts # or index.js\n```\n\nIn the example above, `index.ts` is created in the root of the CLI source folder `src`, \nwhich is defined as the top-most command in CLI. \n\n```\n.\n└── src\n    └── index.ts\n```\n\n\n### 3. `vim index.ts`\n\nAdd the code and finish your first Pero app!\n\n```typescript\nimport { Command, Args } from 'pero'\n\nexport default (command: Command) =\u003e {\n  // command registration: define your command here\n  command\n    .argument('[something]', 'your-description')\n    .option('-e', 'environment')\n\n  // action\n  return (args: Args) =\u003e {\n    // do something with user-input args here\n    \n    command.help() // print help message\n  }\n}\n```\n\nIn Pero, we have to two steps in our runtime:\n\n- Step1: Registration, in the outer callback we have `command` passed as the first param, you can utilize this to define your command's arguments or options. \n- Step2: Action, in the inner callback we have `args` passed to, you may do something with user-input args \n\n\n### 4. Compile and run\n\n```bash\nnpx pero src --name \"name-your-cli\"\n```\n\nYour CLI will be emitted to `dist`\n\nRun the code below, you will get the corresponding help message in the terminal.\n\n```bash\nnode ./dist/pero.js\n```\n\n\n## Advanced Usage\n\n\n### Nested Command\n\nWith the demo project introduced in the Quick Tour section, try to add a new folder under `src` folder,\nyou will get the nested command right away! This is really cool.\n\n```\n.\n└── src\n    ├── build ## the sub-command we added\n    │    └── index.ts\n    └── index.ts\n```\n\nTo trigger the sub-command `build`, do the compilation first and run:\n\n```bash\nnode ./dist/index.js build\n```\n\nYou will see anything in the sub-command's action printed to the screen. Great!\n\n\n## 📍Roadmap\n\nThis project is under heavy development, you may refer to [this](https://github.com/h-a-n-a/pero/issues/1) to get the latest update!\n\n\n## Acknowledgement\n\nSpecial thanks to @yisar132 for the logo, it's great!\n\n## LICENSE\n\n[MIT](./LICENSE) License © 2021 [H](https://github.com/h-a-n-a)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh-a-n-a%2Fpero","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fh-a-n-a%2Fpero","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh-a-n-a%2Fpero/lists"}