{"id":13507607,"url":"https://github.com/msoedov/firex","last_synced_at":"2025-09-06T10:33:27.644Z","repository":{"id":62429661,"uuid":"90919318","full_name":"msoedov/firex","owner":"msoedov","description":"Firex is a library for automatically generating command line interfaces (CLIs) from elixir module","archived":false,"fork":false,"pushed_at":"2018-02-16T19:01:38.000Z","size":64,"stargazers_count":26,"open_issues_count":4,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-10T18:45:41.472Z","etag":null,"topics":["cli","cli-generators","elixir"],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/msoedov.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}},"created_at":"2017-05-11T00:12:46.000Z","updated_at":"2025-04-11T13:51:27.000Z","dependencies_parsed_at":"2022-11-01T20:06:20.512Z","dependency_job_id":null,"html_url":"https://github.com/msoedov/firex","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/msoedov/firex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msoedov%2Ffirex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msoedov%2Ffirex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msoedov%2Ffirex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msoedov%2Ffirex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/msoedov","download_url":"https://codeload.github.com/msoedov/firex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msoedov%2Ffirex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273679354,"owners_count":25148625,"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","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["cli","cli-generators","elixir"],"created_at":"2024-08-01T02:00:36.917Z","updated_at":"2025-09-06T10:33:27.352Z","avatar_url":"https://github.com/msoedov.png","language":"Elixir","readme":"# Firex\n\n[![Build Status](https://travis-ci.org/msoedov/firex.svg?branch=master)](https://travis-ci.org/msoedov/firex)\n[![Hex Version](https://img.shields.io/hexpm/v/firex.svg)](https://hex.pm/packages/firex)\n\nFirex is a library for automatically generating command line interfaces (CLIs) from an elixir module\n\n- Inspired by [Python Fire](https://github.com/google/python-fire)\n- Built on top of `OptionParser` and `escript`\n- Enhance exploring existing code or turning other people's code into a CLI for evaluation.\n- Outputs [escript]( http://erlang.org/doc/man/escript.html) script executable (binary data)\n\n\n## Basic Usage\n\nAdd `use Firex` to any module you would like to expose\n\n```elixir\ndefmodule Example do\n  use Firex\n  @moduledoc \"\"\"\n  Module for my awesome launcher\n  \"\"\"\n  @doc \"\"\"\n  Launch some awesome thing\n  \"\"\"\n  @spec launch(String.t, String.t) :: String.t\n  def launch(message, path) do\n    IO.puts \"Hallo #{message} at `#{path}`\"\n  end\n  @spec launch(String.t, String.t, Bool.t) :: String.t\n  def launch(message, path, force) do\n    IO.puts \"Hallo #{message} at `#{path}` and forced #{force}\"\n  end\n\n  @doc \"\"\"\n  Stop previous task by id\n  \"\"\"\n  @spec stop(String.t) :: String.t\n  def stop(task_id) do\n    IO.puts \"Stopping task #{task_id}\"\n  end\n\n  @doc \"\"\"\n  Increments by one\n  \"\"\"\n  @spec inc(Integer.t) :: String.t\n  def inc(number) do\n    IO.puts \"Result #{number + 1}\"\n  end\n\nend\n```\n\nAdd it `escript: [main_module: Example]` to your mix file\n```elixir\n# mix.exs\ndef project do\n  [\n   ...\n    escript: [main_module: Example],\n   ...\n  ]\nend\n```\nand then\n\n```shell\n➜ mix escript.build\nGenerated escript app with MIX_ENV=dev\n➜ ./app\nModule for my awesome launcher\n\nAvailable commands:\n\n    launch: -m --message [message:string], -p --path [path:string], -f --force [force:boolean]\n\n        Launch some awesome thing\n\n\n    stop: -t --task_id [task_id:string]\n\n        Stop previous task by id\n\n\n    inc: -n --number [number:integer]\n\n        Increments by one\n\n➜ ./app inc -n 3\nResult 4\n```\n\n## Installation\n\nIf [available in Hex](https://hex.pm/packages/firex), the package can be installed as:\n\nAdd `firex` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [{:firex, \"~\u003e 0.1.0\"}]\nend\n```\n\n## Todos\n\nKnown issues and opportunity for improvements:\n\n- [x] Convert `@spec` into `OptionParser` flags\n  - Currently only `:string` is used\n- [x] Proper exit codes\n  - Proper exit code on traceback\n- [ ] Warn when extra arguments passed\n- [ ] Autoregister main module - e.g `escript: [main_module: Example]``\n- [ ] Colour output\n\n## License\n\nFirex is [MIT Licensed](./LICENSE).\n","funding_links":[],"categories":["Command Line Applications"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsoedov%2Ffirex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmsoedov%2Ffirex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsoedov%2Ffirex/lists"}