hanzo 1.0.2

Dart native
Flutter Android iOS

A library to easily use git hooks from Dart.

hanzo #

A library to easily use git hooks from Dart

Install #

To start using Hanzo, add it to your dev_dependencies and run pub get

To install hooks in your project, run:

$ pub run hanzo install
    

Now create a matching git hook dart file in ./tool directory (create if needed).

Example:

    // in ./tool/pre_commit.dart
    main(List<String> arguments) => 
        print("I'll run before a commit is made!");

    // in ./tool/commit_msg.dart
    main(List<String> arguments) => 
        print("I'll run after commit message is entered!");

Install options #

$ pub global activate hanzo
$ hanzo -i pre_commit -s
Option/Flagabbreviationdescription
--add-sample-sIf flag is passed it will create a sample Dart script. Defaults to false
--install <hook_name>-iCreates a bash script for the hook passed. Defaults to pre_commit script. Example: -i pre_commit
--remove <hook_name>-rRemoves a bash script for the hook passed. Example: -r pre_commit. Defaults to all

Remove #

To remove all hooks in your project, run:

$ hanzo -r

Or if you want to remove a specific hook:

$ hanzo -r pre_commit

Git Hooks #

Git hooks are scripts that run automatically every time a particular event occurs in a Git repository. Hanzo supports all git hooks (https://git-scm.com/docs/githooks)

Git hookDart script name
applypatch-msgapplypatch_msg.dart
commit-msgcommit_msg.dart
post-applypatchpost_applypatch.dart
post-checkoutpost_checkout.dart
post-commitpost_commit.dart
post-mergepost_merge.dart
post-receivepost_receive.dart
post-rewritepost_rewrite.dart
post-updatepost_update.dart
pre-applypatchpre_applypatch.dart
pre-auto-gcpre_auto_gc.dart
pre-commitpre_commit.dart
pre-pushpre_push.dart
pre-rebasepre_rebase.dart
pre-receivepre_receive.dart
prepare-commit-msgprepare_commit_msg.dart
push-to-checkoutpush_to_checkout.dart
updateupdate.dart

Accessing Git params #

Git params will be passed as arguments to the main function of the Dart script.

Features and bugs #

Please file feature requests and bugs at the issue tracker.

1
likes
60
pub points
14%
popularity

A library to easily use git hooks from Dart.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

a.araujo.azua@gmail.com

License

BSD (LICENSE)

Dependencies

args, build_cli, build_cli_annotations, io

More

Packages that depend on hanzo