{"id":18407629,"url":"https://github.com/practical-works/nodejs-cli","last_synced_at":"2025-04-12T21:14:33.107Z","repository":{"id":248773654,"uuid":"408022130","full_name":"practical-works/nodejs-cli","owner":"practical-works","description":"💻 Command line interface (CLI) example in NodeJS.","archived":false,"fork":false,"pushed_at":"2021-09-19T18:08:48.000Z","size":112,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T21:14:30.805Z","etag":null,"topics":["cli","command-line-interface","command-line-tool","node","node-cli","node-command-line","node-commandline","node-js","nodejs","nodejs-cli","nodejs-command"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/practical-works.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2021-09-19T03:29:41.000Z","updated_at":"2023-02-13T22:31:18.000Z","dependencies_parsed_at":"2024-07-17T03:09:37.118Z","dependency_job_id":null,"html_url":"https://github.com/practical-works/nodejs-cli","commit_stats":null,"previous_names":["practical-works/nodejs-cli"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/practical-works%2Fnodejs-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/practical-works%2Fnodejs-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/practical-works%2Fnodejs-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/practical-works%2Fnodejs-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/practical-works","download_url":"https://codeload.github.com/practical-works/nodejs-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631681,"owners_count":21136562,"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-interface","command-line-tool","node","node-cli","node-command-line","node-commandline","node-js","nodejs","nodejs-cli","nodejs-command"],"created_at":"2024-11-06T03:14:42.399Z","updated_at":"2025-04-12T21:14:33.088Z","avatar_url":"https://github.com/practical-works.png","language":"JavaScript","readme":"# 💻 NodeJS CLI\n\n[![Web](https://img.shields.io/badge/web-blue?logo=w3c)](https://github.com/topics/web)\n[![JavaScript](https://img.shields.io/badge/javascript-blue?logo=javascript)](https://github.com/topics/javascript)\n[![NodeJS](https://img.shields.io/badge/node-blue?logo=node.js)](https://github.com/topics/node)\n\nSimple Command line interface (CLI) application example in NodeJS.\n\nThis is a simple example that shows how you can natively play around with the NodeJS command arguments.\nIf you want a complete solution for building NodeJS CLI applications, I'd suggest you go for the [Commander](https://github.com/tj/commander.js) library 😻.\n\n![Screenshot](./screenshot.gif?raw=true)\n\n## 🏁 Try it!\n\n1. Clone the repository.\n\n2. Stay in the parent folder of the project.\n\n3. Execute the application:\n```bash\nnode nodejs-cli\n```\nthis will automatically execute the `index.js` file inside the `nodejs-cli` folder.\n\u003e **Output:** No options provided.\n\n\n4. Execute with some flags:\n\n- _Help_ flag: `--help`\n```bash\nnode nodejs-cli --help\n```\n\u003e **Output:** This is an example cli app with nodeJS..\n\n- _Help_ flag alias: `-h`\n```bash\nnode nodejs-cli -h\n```\n\u003e **Output:** This is an example cli app with nodeJS..\n\n- _Name_ flag with parameter: `--name` or `-n`\n```bash\nnode nodejs-cli --name Ambratolm\n```\n\u003e **Output:** Hello, Ambratolm! Welcome! :D\n\n## 🚀 Features\n- Execute command options through flags (arguments prefixed with \"--\") with aliases (arguments shorthands prefixed with \"-\").\n- If flags are duplicate or merged with their aliases it executes the associated command one time only.\n- Prompts unknown flags.\n- To add a new option flag, just add a method in the `actions/@methods.js` file.\n- To add an alias for a flag, just add an entry in `actions/@aliases.js` file with the name of the targeted method as the key and an array of aliases as the value.\n\n## 📃 License\nLicensed under [MIT](./LICENSE).","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpractical-works%2Fnodejs-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpractical-works%2Fnodejs-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpractical-works%2Fnodejs-cli/lists"}