79d0182a2666a98f04bd0d731012ce97114c1ef1

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

refactor(hanami): change global aliases and clean up README

Diff

 1diff --git a/plugins/hanami/README.md b/plugins/hanami/README.md
 2index 3ac8defbb94c2d737678cd6526fcb33b8d3e456f..c9e09f4f233b200e27fd7366f83488357c36676b 100644
 3--- a/plugins/hanami/README.md
 4+++ b/plugins/hanami/README.md
 5@@ -1,32 +1,45 @@
 6-# Hanami Plugin #
 7-This plugin adds convenient ways to work with [Hanami](https://hanamirb.org/) via console.
 8+# Hanami Plugin
 9+
10+This plugin adds convenient aliases to work with [Hanami](https://hanamirb.org/) via console.
11 It's inspired by Rails plugin, so if you've used it, you'll feel like home.
12 
13-## Usage ##
14+To use it, add `hanami` to the plugins array in your zshrc file:
15+
16+```zsh
17+plugins=(... hanami)
18+```
19+
20+## Usage
21 
22 For example, type `hc` into your console when you're within Hanami project directory to run
23 the application console. Have a look at available shortcuts below. You can read more about
24 these commands [on the official website](https://hanamirb.org/guides/command-line/applications/).
25 
26-## Aliases ##
27-
28-| Alias | Command                   | Description                                             |
29-|-------|---------------------------|---------------------------------------------------------|
30-| HED   | HANAMI_ENV=development    | Set environment variable HANAMI_ENV to development      |
31-| HEP   | HANAMI_ENV=production     | Set environment variable HANAMI_ENV to production       |
32-| HET   | HANAMI_ENV=test           | Set environment variable HANAMI_ENV to test             |
33-| hc    | hanami console            | Run application console                                 |
34-| hd    | hanami destroy            | Remove specified hanami resource                        |
35-| hg    | hanami generate           | Create specified hanami resource                        |
36-| hgm   | hanami generate migration | Create migration file                                   |
37-| hs    | hanami server             | Launch server with hanami application                   |
38-| hsp   | hanami server -p          | Launch server with specified port                       |
39-| hr    | hanami routes             | List application routes                                 |
40-| hdc   | hanami db create          | Create application database                             |
41-| hdd   | hanami db drop            | Delete application database                             |
42-| hdp   | hanami db prepare         | Prepare database for the current environment            |
43-| hda   | hanami db apply           | Recreates a fresh schema after migrations (destructive) |
44-| hdv   | hanami db version         | Print current database version                          |
45-| hdrs  | hdd && hdp                | Drop and recreate application database                  |
46-| hdtp  | HET hdp                   | Actualize test environment database                     |
47-| hrg   | hr &#124; grep            | Grep hanami routes with specified pattern               |
48+## Aliases
49+
50+| Alias | Command                     | Description                                             |
51+|-------|-----------------------------|---------------------------------------------------------|
52+| HED\* | `HANAMI_ENV=development`    | Set environment variable HANAMI_ENV to development      |
53+| HEP\* | `HANAMI_ENV=production`     | Set environment variable HANAMI_ENV to production       |
54+| HET\* | `HANAMI_ENV=test`           | Set environment variable HANAMI_ENV to test             |
55+| hc    | `hanami console`            | Run application console                                 |
56+| hd    | `hanami destroy`            | Remove specified hanami resource                        |
57+| hg    | `hanami generate`           | Create specified hanami resource                        |
58+| hgm   | `hanami generate migration` | Create migration file                                   |
59+| hs    | `hanami server`             | Launch server with hanami application                   |
60+| hsp   | `hanami server -p`          | Launch server with specified port                       |
61+| hr    | `hanami routes`             | List application routes                                 |
62+| hdc   | `hanami db create`          | Create application database                             |
63+| hdd   | `hanami db drop`            | Delete application database                             |
64+| hdp   | `hanami db prepare`         | Prepare database for the current environment            |
65+| hda   | `hanami db apply`           | Recreates a fresh schema after migrations (destructive) |
66+| hdv   | `hanami db version`         | Print current database version                          |
67+| hdrs  | `hdd && hdp`                | Drop and recreate application database                  |
68+| hdtp  | `HET hdp`                   | Actualize test environment database                     |
69+| hrg   | `hr | grep`                 | Grep hanami routes with specified pattern               |
70+
71+\* You should use these at the beginning of a command, for example:
72+
73+```console
74+$ HED hdd # equivalent to 'HANAMI_ENV=development hanami db drop'
75+```
76diff --git a/plugins/hanami/hanami.plugin.zsh b/plugins/hanami/hanami.plugin.zsh
77index 349c42cae847b0b04ff306c3fd526811210a9d36..42143b428f145e4a6d8fd70921ce8e23d9614c73 100644
78--- a/plugins/hanami/hanami.plugin.zsh
79+++ b/plugins/hanami/hanami.plugin.zsh
80@@ -1,6 +1,6 @@
81-alias -g HED='HANAMI_ENV=development'
82-alias -g HEP='HANAMI_ENV=production'
83-alias -g HET='HANAMI_ENV=test'
84+alias HED='HANAMI_ENV=development '
85+alias HEP='HANAMI_ENV=production '
86+alias HET='HANAMI_ENV=test '
87 
88 alias hc='hanami console'
89 alias hd='hanami destroy'