{"id":13464809,"url":"https://github.com/craigmulligan/js-fire","last_synced_at":"2025-03-25T11:32:12.483Z","repository":{"id":37752262,"uuid":"148508838","full_name":"craigmulligan/js-fire","owner":"craigmulligan","description":"A javascript clone of google/python-fire 🔥","archived":false,"fork":false,"pushed_at":"2024-06-25T13:14:39.000Z","size":555,"stargazers_count":456,"open_issues_count":3,"forks_count":10,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-11T05:42:38.413Z","etag":null,"topics":["cli","hacktoberfest","javascript","node","nodejs","python-fire"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/craigmulligan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2018-09-12T16:22:47.000Z","updated_at":"2025-02-18T12:50:36.000Z","dependencies_parsed_at":"2023-02-08T07:46:12.263Z","dependency_job_id":"43d89c3b-0720-4faf-a919-24c2169fd32e","html_url":"https://github.com/craigmulligan/js-fire","commit_stats":{"total_commits":64,"total_committers":5,"mean_commits":12.8,"dds":0.453125,"last_synced_commit":"03a7b57e064d3c22ebef8d0af002a321006f3564"},"previous_names":["hobochild/js-fire"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigmulligan%2Fjs-fire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigmulligan%2Fjs-fire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigmulligan%2Fjs-fire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigmulligan%2Fjs-fire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/craigmulligan","download_url":"https://codeload.github.com/craigmulligan/js-fire/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245454241,"owners_count":20617995,"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","hacktoberfest","javascript","node","nodejs","python-fire"],"created_at":"2024-07-31T14:00:50.733Z","updated_at":"2025-03-25T11:32:11.169Z","avatar_url":"https://github.com/craigmulligan.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# js-fire [![Node.js CI](https://github.com/hobochild/js-fire/actions/workflows/node.js.yml/badge.svg)](https://github.com/hobochild/js-fire/actions/workflows/node.js.yml)\n\n\u003e A javascript implementation of [google/python-fire](https://github.com/google/python-fire)\n\njs-fire is a library for automatically generating command line interfaces\n(CLIs) from most js objects.\n\n- js Fire is a simple way to create a CLI in js.\n- js Fire helps with exploring existing code or turning other people's code\n  into a CLI.\n- js Fire makes transitioning between Bash and js easier.\n\n## Installation\n\n```\nyarn add js-fire\n```\n\n```\nnpm install js-fire\n```\n\njs-fire is exposed as both an [API](#api-usage) and a [CLI](#cli-usage).\n\n## API Usage\n\nYou can call `Fire` on any functions and objects:\u003cbr\u003e\n\nHere's an example of calling Fire on a object, you can infinitely nest objects to create subcommands.\n\n```javascript\nconst fire = require(\"js-fire\");\n\nconst calculator = {\n  __description__: \"I am a math machine\",\n  double: (number) =\u003e {\n    // I double things\n    return 2 * number;\n  },\n  add: (n1 = Math.PI, n2) =\u003e {\n    return n1 + n2;\n  },\n  misc: {\n    year: () =\u003e \"1999\",\n    brand: () =\u003e \"casio\",\n    hello: (name) =\u003e `hello ${name}`,\n  },\n};\n\nfire(calculator);\n```\n\nThen, from the command line, you can run:\n\n```bash\nnode calculator.js double --number=15  # 30\n```\n\n```bash\nnode calculator.js misc hello hobochild  # 'hello hobochild'\n```\n\nAutomactic `--help` command.\n\n```bash\nnode calculator.js --help\n\nUSAGE:\n\tnode calculator.js\n\nDESCRIPTION:\n\tI am a math machine\n\nCOMMANDS:\n\n\thalf  --number=\u003cnumber\u003e\n\tdouble  --number=\u003cnumber\u003e\n\tadd  --n1=3.141592653589793  --n2=\u003cn2\u003e\n\n\tmisc\n\t\tyear\n\t\tbrand\n\t\thello  --name=\u003cname\u003e\n```\n\nAutomatic `--interactive` mode:\n\n[![asciicast](https://asciinema.org/a/QdxxOZgsK4Wp0nxT7ZEn6mXIi.svg)](https://asciinema.org/a/QdxxOZgsK4Wp0nxT7ZEn6mXIi)\n\nFor additional examples, see [/examples](/examples).\n\n## CLI Usage\n\njs-fire exposes a CLI that takes modulePath and passes it to `js-fire`.\n\n```bash\nUSAGE:\n\tjs-fire  --modulePath=\u003cmodulePath\u003e\n```\n\n### Example\n\nSo you can js-fire on _most_ js modules.\n\n```bash\njs-fire fs -- writeFileSync --path=hello.txt --data=\"hiii\"\n```\n\nYou can also use `interactive` and `help` mode to explore a modules api:\n\n```bash\njs-fire fs -- -h\n\nUSAGE:\n\tjs-fire\n\nCOMMANDS:\n\n\tappendFile \u003cflags\u003e --path=\u003cpath\u003e  --data=\u003cdata\u003e  --options=\u003coptions\u003e  --callback=\u003ccallback\u003e\n\tappendFileSync \u003cflags\u003e --path=\u003cpath\u003e  --data=\u003cdata\u003e  --options=\u003coptions\u003e\n\taccess \u003cflags\u003e --path=\u003cpath\u003e  --mode=\u003cmode\u003e  --callback=\u003ccallback\u003e\n\taccessSync \u003cflags\u003e --path=\u003cpath\u003e  --mode=\u003cmode\u003e\n\tchown \u003cflags\u003e --path=\u003cpath\u003e  --uid=\u003cuid\u003e  --gid=\u003cgid\u003e  --callback=\u003ccallback\u003e\n\tchownSync \u003cflags\u003e --path=\u003cpath\u003e  --uid=\u003cuid\u003e  --gid=\u003cgid\u003e\n\tchmod \u003cflags\u003e --path=\u003cpath\u003e  --mode=\u003cmode\u003e  --callback=\u003ccallback\u003e\n\tchmodSync \u003cflags\u003e --path=\u003cpath\u003e  --mode=\u003cmode\u003e\n\tclose \u003cflags\u003e --fd=\u003cfd\u003e  --callback=\u003ccallback\u003e\n\tcloseSync \u003cflags\u003e --fd=\u003cfd\u003e\n\tcopyFile \u003cflags\u003e --src=\u003csrc\u003e  --dest=\u003cdest\u003e  --flags=\u003cflags\u003e  --callback=\u003ccallback\u003e\n\tcopyFileSync \u003cflags\u003e --src=\u003csrc\u003e  --dest=\u003cdest\u003e  --flags=\u003cflags\u003e\n\tcreateReadStream \u003cflags\u003e --path=\u003cpath\u003e  --options=\u003coptions\u003e\n\tcreateWriteStream \u003cflags\u003e --path=\u003cpath\u003e  --options=\u003coptions\u003e\n\texists \u003cflags\u003e --path=\u003cpath\u003e  --callback=\u003ccallback\u003e\n\texistsSync \u003cflags\u003e --path=\u003cpath\u003e\n  ...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraigmulligan%2Fjs-fire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcraigmulligan%2Fjs-fire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraigmulligan%2Fjs-fire/lists"}