08b73f92c86c3e0e622b7eeca61b6aa6ad4da7be

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

Message

lighthouse: add README and clean up plugin (#7316)

Diff

 1diff --git a/plugins/lighthouse/README.md b/plugins/lighthouse/README.md
 2new file mode 100644
 3index 0000000000000000000000000000000000000000..0db29b4e582537082ff87db22f07470df8cf98fd
 4--- /dev/null
 5+++ b/plugins/lighthouse/README.md
 6@@ -0,0 +1,26 @@
 7+# Lighthouse plugin
 8+
 9+This plugin adds commands to manage [Lighthouse](https://lighthouseapp.com/).
10+
11+To use it, add `lighthouse` to the plugins array in your zshrc file:
12+
13+```zsh
14+plugins=(... lighthouse)
15+```
16+
17+## Commands
18+
19+* `open_lighthouse_ticket <issue>` (alias: `lho`):
20+
21+  Opens the URL to the issue passed as an argument. To use it, add a `.lighthouse-url`
22+  file in your directory with the URL to the individual project.
23+
24+  Example:
25+  ```zsh
26+  $ cat .lighthouse-url
27+  https://rails.lighthouseapp.com/projects/8994
28+
29+  $ lho 23
30+  Opening ticket #23
31+  # The browser goes to https://rails.lighthouseapp.com/projects/8994/tickets/23
32+  ```
33diff --git a/plugins/lighthouse/lighthouse.plugin.zsh b/plugins/lighthouse/lighthouse.plugin.zsh
34index 4a47b60109cfdecedafbc10d4251033dd193c5a3..3fca2bf4f8fa9ed4a7b8b6925f8218a8eb0f5b74 100644
35--- a/plugins/lighthouse/lighthouse.plugin.zsh
36+++ b/plugins/lighthouse/lighthouse.plugin.zsh
37@@ -1,16 +1,12 @@
38-# To use: add a .lighthouse file into your directory with the URL to the
39-# individual project. For example:
40-# https://rails.lighthouseapp.com/projects/8994
41-# Example usage: https://screencast.com/t/ZDgwNDUwNT
42 open_lighthouse_ticket () {
43   if [ ! -f .lighthouse-url ]; then
44     echo "There is no .lighthouse-url file in the current directory..."
45-    return 0;
46-  else
47-    lighthouse_url=$(cat .lighthouse-url);
48-    echo "Opening ticket #$1";
49-    open_command "$lighthouse_url/tickets/$1";
50+    return 0
51   fi
52+
53+  lighthouse_url=$(cat .lighthouse-url)
54+  echo "Opening ticket #$1"
55+  open_command "$lighthouse_url/tickets/$1"
56 }
57 
58 alias lho='open_lighthouse_ticket'