wip-cli 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d82933e6cb8f40235f6ac0f64ce48cd7cef3b2b9cd7db993d080a6a2713392c4
4
- data.tar.gz: 56dc25b33282f766d3714dab200a6915bcf59f686c6f6f7db734de174e4c31da
3
+ metadata.gz: afa60166355b47b1558e9f0f7a3a9d7e3e1226cef584899abac7be4286f471a3
4
+ data.tar.gz: f3540c62c2304616726ee38f27d8e7e224e83b23e71542b2291be55bd2903603
5
5
  SHA512:
6
- metadata.gz: e470170e797827cb0ce81070bec1c6e5388659fc868edbce9c284f193a3a971296c27a193d7f93c5ba3906318893240c9efca56bae2023361e225f988c0ffb0b
7
- data.tar.gz: 231a561c87e1d5aac68fa894e48a9d6d426763151fdd80249779e5734c81531eadfa914527db8f1118b74e9e31b2476f0f1367257ad9f4c2836f623baf36f849
6
+ metadata.gz: 69cb10303ae0f2b0ed1dce87b63d6c0f1e1a60b7c13ca5ffbe9facbb51f12d10ebc8734f0292c293bd64be258438a02f48e68eec3a30b4d173ab8ffd9577a4c9
7
+ data.tar.gz: fea2800ca42508e40c6438d79e42d189545c25fe3339ebf0a617dfd989f5402015cd94ed46b4115055837b02388a86e00f766a207cce2248a73791e5cc72639a
@@ -2,10 +2,18 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [1.4.0] - 2020-11-20
6
+
7
+ ### Added
8
+
9
+ - Interactive mode to toggle todos: `wip todos -i`
10
+
11
+ ## [1.3.0] - 2020-11-13
12
+
5
13
  ### Added
6
14
 
7
- - Added shortcut command to get your profile: `wip me`
8
- - Added command to get a user profile: `wip user 2051` or `wip user sowenjub`
15
+ - Shortcut command to get your profile: `wip me`
16
+ - Command to get a user profile: `wip user 2051` or `wip user sowenjub`
9
17
 
10
18
  ### Changed
11
19
 
@@ -15,11 +23,11 @@
15
23
 
16
24
  ### Added
17
25
 
18
- - Added options to uncomplete a todo: `wip complete -u 123 `
19
- - Added command to delete a todo: `wip delete 123`
20
- - Added command to get any users todos: `wip todos -u sowenjub`
21
- - Added command to get viewer todos: `wip todos`
22
- - Added method to get viewer: `Wip::User.viewer`
26
+ - Options to uncomplete a todo: `wip complete -u 123 `
27
+ - Command to delete a todo: `wip delete 123`
28
+ - Command to get any users todos: `wip todos -u sowenjub`
29
+ - Command to get viewer todos: `wip todos`
30
+ - Method to get viewer: `Wip::User.viewer`
23
31
 
24
32
  ## [1.1.0] - 2020-11-11
25
33
 
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- wip-cli (1.3.0)
4
+ wip-cli (1.4.0)
5
5
  thor (~> 1.0)
6
+ tty-prompt (~> 0.22)
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
@@ -10,6 +11,8 @@ GEM
10
11
  byebug (11.1.3)
11
12
  concurrent-ruby (1.1.7)
12
13
  diff-lcs (1.4.4)
14
+ pastel (0.8.0)
15
+ tty-color (~> 0.5)
13
16
  rake (13.0.1)
14
17
  rspec (3.10.0)
15
18
  rspec-core (~> 3.10.0)
@@ -25,8 +28,19 @@ GEM
25
28
  rspec-support (~> 3.10.0)
26
29
  rspec-support (3.10.0)
27
30
  thor (1.0.1)
31
+ tty-color (0.6.0)
32
+ tty-cursor (0.7.1)
33
+ tty-prompt (0.22.0)
34
+ pastel (~> 0.8)
35
+ tty-reader (~> 0.8)
36
+ tty-reader (0.8.0)
37
+ tty-cursor (~> 0.7)
38
+ tty-screen (~> 0.8)
39
+ wisper (~> 2.0)
40
+ tty-screen (0.8.1)
28
41
  tzinfo (2.0.3)
29
42
  concurrent-ruby (~> 1.0)
43
+ wisper (2.0.1)
30
44
 
31
45
  PLATFORMS
32
46
  ruby
data/exe/wip CHANGED
@@ -3,4 +3,9 @@
3
3
  require "wip"
4
4
  require "wip/cli"
5
5
 
6
+ if ARGV[0] == "--version"
7
+ puts Wip::VERSION
8
+ exit
9
+ end
10
+
6
11
  Wip::CLI.start(ARGV)
@@ -1,8 +1,10 @@
1
1
  require "date"
2
2
  require "thor"
3
+ require "tty-prompt"
3
4
  require "tzinfo"
4
5
  require "wip"
5
6
  require "wip/todo"
7
+ require "byebug"
6
8
 
7
9
  class Wip::CLI < Thor
8
10
  class_option :verbose, :type => :boolean, :aliases => "-v"
@@ -38,16 +40,30 @@ class Wip::CLI < Thor
38
40
  end
39
41
 
40
42
  desc "todos", "List viewer todos"
41
- method_option :completed, type: :boolean, aliases: '-c'
43
+ method_option :completed, type: :boolean, aliases: '-c', desc: "Filter by status"
42
44
  method_option :filter, type: :string, aliases: '-f'
45
+ method_option :interactive, type: :boolean, aliases: '-i', default: false, desc: "Toggle todos statuses by selecting them"
43
46
  method_option :limit, type: :numeric, aliases: '-l', default: 5
44
- method_option :order, type: :string, aliases: '-o', default: "completed_at:desc"
47
+ method_option :order, type: :string, aliases: '-o', default: "created_at:desc"
45
48
  method_option :username, type: :string, aliases: '-u'
46
49
  def todos
47
50
  todos_options = options.slice("completed", "filter", "limit", "order")
48
51
  user = options.username.nil? ? Wip::User.viewer(todos: todos_options) : Wip::User.find(username: options.username, todos: todos_options)
49
- user.todos.each do |todo|
50
- puts todo.description
52
+ if options.interactive
53
+ prompt = TTY::Prompt.new
54
+ options = user.todos.inject({}) do |h, todo|
55
+ h[todo.description] = todo.id
56
+ h
57
+ end
58
+ choice = prompt.multi_select("Toggle todos?", options, per_page: todos_options["limit"])
59
+ puts "No change" if choice.empty?
60
+ choice.each do |todo_id|
61
+ todo = user.todos.find { |todo| todo.id == todo_id }
62
+ todo.toggle
63
+ puts todo.description
64
+ end
65
+ else
66
+ user.todos.each { |todo| puts todo.description }
51
67
  end
52
68
  end
53
69
 
@@ -98,6 +98,10 @@ class Wip::Todo
98
98
  end
99
99
  end
100
100
 
101
+ def toggle
102
+ done? ? uncomplete : complete
103
+ end
104
+
101
105
  def save
102
106
  client.request create_query
103
107
  client.data("createTodo").tap do |params|
@@ -1,3 +1,3 @@
1
1
  module Wip
2
- VERSION = "1.3.0"
2
+ VERSION = "1.4.0"
3
3
  end
@@ -31,4 +31,5 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency 'rspec', "~> 3.9"
32
32
 
33
33
  spec.add_runtime_dependency "thor", "~> 1.0"
34
+ spec.add_runtime_dependency "tty-prompt", "~> 0.22"
34
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wip-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arnaud Joubay
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-13 00:00:00.000000000 Z
11
+ date: 2020-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tzinfo
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: tty-prompt
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.22'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.22'
83
97
  description: A simple gem to manage wip.co todos from the command line.
84
98
  email:
85
99
  executables: