{"id":32301580,"url":"https://github.com/beta/haru","last_synced_at":"2026-02-21T08:36:28.084Z","repository":{"id":56831928,"uuid":"72220484","full_name":"beta/haru","owner":"beta","description":"An easy-to-use framework for creating command-line applications in Dart.","archived":false,"fork":false,"pushed_at":"2017-12-22T10:04:47.000Z","size":35,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-27T17:07:52.677Z","etag":null,"topics":["cli","dart"],"latest_commit_sha":null,"homepage":"","language":"Dart","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/beta.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":"2016-10-28T15:42:53.000Z","updated_at":"2017-02-16T13:52:21.000Z","dependencies_parsed_at":"2022-09-07T14:20:18.947Z","dependency_job_id":null,"html_url":"https://github.com/beta/haru","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/beta/haru","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beta%2Fharu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beta%2Fharu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beta%2Fharu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beta%2Fharu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beta","download_url":"https://codeload.github.com/beta/haru/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beta%2Fharu/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29677602,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T06:23:40.028Z","status":"ssl_error","status_checked_at":"2026-02-21T06:23:39.222Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["cli","dart"],"created_at":"2025-10-23T05:42:38.339Z","updated_at":"2026-02-21T08:36:28.079Z","avatar_url":"https://github.com/beta.png","language":"Dart","readme":"# Haru\n\nHaru is an easy-to-use framework for creating command-line applications with Dart.\n\n## Installation\n\nInstall Haru with [Pub](https://pub.dartlang.org/). See [this page](https://pub.dartlang.org/packages/haru#-installing-tab-) for instructions.\n\n## Getting started\n\n\u003e This guide is aimed for the 1.0 version of Haru. Documentation for the 0.x versions can be found [here](https://www.dartdocs.org/documentation/haru/0.1.1/).\n\n\u003e Haru is in the progress of refactoring. Changes to this guide are expected.\n\nHaru uses Dart [metadata](https://www.dartlang.org/guides/language/language-tour#metadata) to configure a CLI app. First, create a class for your app with an `@app` metadata. Suppose we are developing a Git command-line client.\n\n```dart\n@app('git') // 'git' is the app name users type in console\nclass GitApp {\n  // TODO\n}\n```\n\nUse the `main` function to start your app.\n\n```dart\nvoid main(List\u003cString\u003e args) {\n  new GitApp()\n      .run(args)\n      .catchError((error) =\u003e print('Error: ${error.toString()}'));\n}\n```\n\nA Haru app is made up of commands. Commands can have flags (`--flag`), options (`--option value`) and positional arguments. For example, in `git add -A src/`,\n\n - `git` is the app name,\n - `add` is the command,\n - `-A` is (an abbreviation of) a flag for the command, and\n - `src/` is the positional argument, the path to be added.\n\nGlobal flags and options are also supported.\n\n### Command\n\nHaru uses instance methods for commands.\n\n```dart\n@command('add')\nvoid add() {\n  // ...\n}\n```\n\nCommands support flags, options and positional arguments. These values are all defined as method parameters.\n\n```dart\n@command('add')\nvoid add(@Arg String pathspec, @flag(abbr: 'A') bool all) {\n  // ...\n}\n```\n\nThe metadatas for flags, options and positional arguments come in two forms.\n\n - The ones starting in uppercase (`@Flag`, `@Option` and `@Arg`) have no parameters. Names of these values are generated automatically from the parameter variable name. For example, parameter `all` will result in `--all`, and `anotherName` -\u003e `--another-name`.\n - The lowercase ones (`@flag`, `@option` and `@arg`) have their parameters. `@flag` and `@option` have two named parameters `name` and `abbr`. Example: `@flag(name: 'flag', abbr: 'f')` will make `--flag` and `-f` work the same. Leading dashes should not be included.\n\n   `@arg` has one named parameter `name`. This value will be used in command usage, for example `@arg(name: 'value')` -\u003e `Usage: appname command \u003cvalue\u003e`.\n\n### Global flags and options\n\nHaru also support global flags and options. These global values can appear anywhere in the command line, for example, `git --verbose add -A src` is equal to `git add -A src --verbose`.\n\nGlobal flags and options are defined as instance variables. For example:\n\n```dart\n@command('git')\nclass GitApp {\n  @Flag\n  bool verbose;\n\n  @command('add')\n  void add(@Arg String pathspec, @flag(abbr: 'A') bool all) {\n    if (verbose) {\n      // ...\n    }\n  }\n}\n```\n\n## More examples\n\nYou can find a complete example of a command-line application in [`example/example.dart`](https://github.com/beta/haru/blob/master/example/example.dart).\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeta%2Fharu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeta%2Fharu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeta%2Fharu/lists"}