pivo 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -2
- data/lib/pivo/version.rb +1 -1
- data/lib/pivo.rb +31 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9aed17f0b7509e7ac12e65e0504c06cec3c3c635
|
4
|
+
data.tar.gz: 0fec22c3a496d57a473ebf155abeb482355eed0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9bcbae984a83ab8243c65b74fa5b8ed6edf7c8b67731ee6db9ef19a413ae7fa72e2e0aac09f435fa455d88bb0780f32db2a119c1c2b994b0efdba0335a98f20
|
7
|
+
data.tar.gz: 33261af7d5f7b1a9260994dfe69eacfd126b802d1b99cccd87aada3a77bb2699f576433cec1a1c26096f3cde34418a2dc621c54be59589a24db7722668b13c25
|
data/README.md
CHANGED
@@ -17,14 +17,21 @@ $ pivo projects
|
|
17
17
|
### Listing stories
|
18
18
|
|
19
19
|
```shell
|
20
|
-
$ pivo stories PROJECT_NAME
|
20
|
+
$ pivo stories all PROJECT_NAME
|
21
|
+
```
|
22
|
+
|
23
|
+
### Listing mywork
|
24
|
+
|
25
|
+
|
26
|
+
```shell
|
27
|
+
$ pivo stories me PROJECT_NAME
|
21
28
|
```
|
22
29
|
|
23
30
|
#### with peco
|
24
31
|
|
25
32
|
```zsh
|
26
33
|
function pivo-open() {
|
27
|
-
local url="$(pivo stories $1 | peco --query "$LBUFFER" | awk '{print $NF}')"
|
34
|
+
local url="$(pivo stories me $1 | peco --query "$LBUFFER" | awk '{print $NF}')"
|
28
35
|
open ${url}
|
29
36
|
}
|
30
37
|
```
|
data/lib/pivo/version.rb
CHANGED
data/lib/pivo.rb
CHANGED
@@ -5,6 +5,34 @@ require 'tracker_api'
|
|
5
5
|
require 'thor'
|
6
6
|
|
7
7
|
module Pivo
|
8
|
+
class Stories < Thor
|
9
|
+
desc "stories all PROJECT_NAME", "listing all stories"
|
10
|
+
def all(project_name)
|
11
|
+
project = client.projects.select {|project| project.name == project_name}[0]
|
12
|
+
project.stories.each do |story|
|
13
|
+
say "[#{story.current_state}]\t#{story.name}\t#{story.url}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "stories me PROJECT_NAME", "listing my stories"
|
18
|
+
def me(project_name)
|
19
|
+
me = client.me
|
20
|
+
project = client.projects.select {|project| project.name == project_name}[0]
|
21
|
+
project.stories(filter: "mywork:\"#{me.name}\"").each do |story|
|
22
|
+
say "[#{story.current_state}]\t#{story.name}\t#{story.url}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def client
|
29
|
+
TrackerApi::Client.new(token: token)
|
30
|
+
end
|
31
|
+
|
32
|
+
def token
|
33
|
+
YAML.load(File.read("#{ENV['HOME']}/.pivo.yml"))['token']
|
34
|
+
end
|
35
|
+
end
|
8
36
|
class CLI < Thor
|
9
37
|
desc "projects", "listing project names"
|
10
38
|
def projects
|
@@ -19,6 +47,9 @@ module Pivo
|
|
19
47
|
end
|
20
48
|
end
|
21
49
|
|
50
|
+
desc "stories SUBCOMMAND ARGS", "listing stories"
|
51
|
+
subcommand "stories", Stories
|
52
|
+
|
22
53
|
private
|
23
54
|
|
24
55
|
def client
|