V2.2: Generate


hanami generate

Hanami 2.2 provides a few generators:

$ bundle exec hanami generate --help
Commands:
  hanami generate action NAME
  hanami generate component NAME
  hanami generate migration NAME
  hanami generate operation NAME
  hanami generate part NAME
  hanami generate relation NAME
  hanami generate repo NAME
  hanami generate slice NAME
  hanami generate struct NAME
  hanami generate view NAME

hanami generate action

Generates an action:

$ bundle exec hanami generate action books.show

Use the --help option to access all accepted options:

$ bundle exec hanami generate action --help

hanami generate component

Generates a component:

$ bundle exec hanami generate component isbn_decode

Use the --help option to access all accepted options:

$ bundle exec hanami generate component --help

hanami generate migration

Generates a migration:

$ bundle exec hanami generate migration create_posts

Use the --help option to access all accepted options:

$ bundle exec hanami generate migration --help

hanami generate operation

Generates an operation:

$ bundle exec hanami generate operation books.add

Use the --help option to access all accepted options:

$ bundle exec hanami generate operation --help

hanami generate part

Generates a view part:

$ bundle exec hanami generate part book

Use the --help option to access all accepted options:

$ bundle exec hanami generate part --help

hanami generate relation

Generates a relation:

$ bundle exec hanami generate relation books

Use the --help option to access all accepted options:

$ bundle exec hanami generate relation --help

hanami generate repo

Generates a repo:

$ bundle exec hanami generate repo books

Use the --help option to access all accepted options:

$ bundle exec hanami generate repo --help

hanami generate slice

Generates a slice:

$ bundle exec hanami generate slice admin

Use the --help option to access all accepted options:

$ bundle exec hanami generate slice --help

hanami generate struct

Generates a struct:

$ bundle exec hanami generate struct book

Use the --help option to access all accepted options:

$ bundle exec hanami generate struct --help

hanami generate view

Generates a view:

$ bundle exec hanami generate view books.create

Use the --help option to access all accepted options:

$ bundle exec hanami generate view --help