abt-cli 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/abt/cli.rb +1 -1
- data/lib/abt/cli/dialogs.rb +10 -7
- data/lib/abt/providers/asana/commands/pick.rb +16 -4
- data/lib/abt/providers/asana/configuration.rb +5 -1
- data/lib/abt/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5044c8e5cb4330dd9db124834ee6f9bffca78a0ffaa08c268ba35eb3b0a21fe9
|
4
|
+
data.tar.gz: d9eb98460e021a032f9efdc0d9b2b98a20b57aba6267ef9024ee6f840bcf6858
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2536f6b91bebf10d0fe637864045f61d04f90aa1b1ede6bd0a0db62ad54ef54cb541eda71fca2554cd741fe0011cb5586a0bb904ec412a6a07d90fc6c477208
|
7
|
+
data.tar.gz: 10c5fcf70d15dcfff152cf62a3d39109db499768c5fbb96d0eadecc107c85150e9277f647da482ea72d6d2cab68974b950500c2e433a0a3f8c1547c6c6fe74a0
|
data/lib/abt/cli.rb
CHANGED
data/lib/abt/cli/dialogs.rb
CHANGED
@@ -25,13 +25,15 @@ module Abt
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def prompt_choice(text, options, allow_back_option = false)
|
28
|
-
if options.one?
|
29
|
-
warn "Selected: #{options.first['name']}"
|
30
|
-
return options.first
|
31
|
-
end
|
32
|
-
|
33
28
|
warn "#{text}:"
|
34
29
|
|
30
|
+
if options.length.zero?
|
31
|
+
abort 'No available options' unless allow_back_option
|
32
|
+
|
33
|
+
warn 'No available options'
|
34
|
+
return nil
|
35
|
+
end
|
36
|
+
|
35
37
|
print_options(options)
|
36
38
|
select_options(options, allow_back_option)
|
37
39
|
end
|
@@ -45,11 +47,12 @@ module Abt
|
|
45
47
|
end
|
46
48
|
|
47
49
|
def select_options(options, allow_back_option)
|
48
|
-
|
50
|
+
loop do
|
51
|
+
number = read_option_number(options.length, allow_back_option)
|
49
52
|
if number.nil?
|
50
53
|
return nil if allow_back_option
|
51
54
|
|
52
|
-
|
55
|
+
next
|
53
56
|
end
|
54
57
|
|
55
58
|
option = options[number - 1]
|
@@ -18,7 +18,7 @@ module Abt
|
|
18
18
|
|
19
19
|
cli.warn project['name']
|
20
20
|
|
21
|
-
task =
|
21
|
+
task = select_task
|
22
22
|
|
23
23
|
config.project_gid = project_gid # We might have gotten the project ID as an argument
|
24
24
|
config.task_gid = task['gid']
|
@@ -32,14 +32,26 @@ module Abt
|
|
32
32
|
@project ||= api.get("projects/#{project_gid}")
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
36
|
-
|
35
|
+
def select_task
|
36
|
+
loop do
|
37
37
|
section = cli.prompt_choice 'Which section?', sections
|
38
38
|
cli.warn 'Fetching tasks...'
|
39
|
-
|
39
|
+
tasks = tasks_in_section(section)
|
40
|
+
|
41
|
+
if tasks.length.zero?
|
42
|
+
cli.warn 'Section is empty'
|
43
|
+
next
|
44
|
+
end
|
45
|
+
|
46
|
+
task = cli.prompt_choice 'Select a task', tasks, true
|
47
|
+
return task if task
|
40
48
|
end
|
41
49
|
end
|
42
50
|
|
51
|
+
def tasks_in_section(section)
|
52
|
+
api.get_paged('tasks', section: section['gid'], opt_fields: 'name,permalink_url')
|
53
|
+
end
|
54
|
+
|
43
55
|
def sections
|
44
56
|
@sections ||= begin
|
45
57
|
cli.warn 'Fetching sections...'
|
@@ -109,9 +109,13 @@ module Abt
|
|
109
109
|
workspaces = api.get_paged('workspaces')
|
110
110
|
if workspaces.empty?
|
111
111
|
cli.abort 'Your asana access token does not have access to any workspaces'
|
112
|
+
elsif workspaces.one?
|
113
|
+
workspace = workspaces.first
|
114
|
+
cli.warn "Selected Asana workspace #{workspace['name']}"
|
115
|
+
else
|
116
|
+
workspace = cli.prompt_choice('Select Asana workspace', workspaces)
|
112
117
|
end
|
113
118
|
|
114
|
-
workspace = cli.prompt_choice('Select Asana workspace', workspaces)
|
115
119
|
git.global['workspaceGid'] = workspace['gid']
|
116
120
|
workspace
|
117
121
|
end
|
data/lib/abt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abt-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesper Sørensen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-inflector
|