abt-cli 0.0.24 → 0.0.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/abt/cli/prompt.rb +12 -9
- data/lib/abt/providers/devops/commands/pick.rb +13 -1
- data/lib/abt/providers/git/commands/branch.rb +1 -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: 3af480b982ad0feef367f157d2658f5dd7a3059de13f7098ff267fd06b53fd47
|
4
|
+
data.tar.gz: 15b6177165d60fa0bc76c0ac201755d9fb987c62b98e97784ebd2eb5748f12bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9eb5c49b996574004c1abffffad6aef76e3bc8ad7ea3fcbf0e05e2b0b33788d01cd041e031f5e98c85b86b7aee442ce8b2ac11995944a1e8d8674053736a6f9b
|
7
|
+
data.tar.gz: 16278e95b9d5e25a7b2fb7dc931e140b732638ce767e99b20a9b7b442a560b6e56abf982f42a65b7dd97973d58332854915421d26cac686a8af8965a0dcaa148
|
data/lib/abt/cli/prompt.rb
CHANGED
@@ -14,17 +14,20 @@ module Abt
|
|
14
14
|
Abt::Helpers.read_user_input
|
15
15
|
end
|
16
16
|
|
17
|
-
def boolean(text)
|
18
|
-
|
17
|
+
def boolean(text, default: nil)
|
18
|
+
choices = [default == true ? "Y" : "y",
|
19
|
+
default == false ? "N" : "n"].join("/")
|
19
20
|
|
20
|
-
|
21
|
-
output.print("(y / n): ")
|
21
|
+
output.print("#{text} (#{choices}): ")
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
input = Abt::Helpers.read_user_input.downcase
|
24
|
+
|
25
|
+
return true if input == "y"
|
26
|
+
return false if input == "n"
|
27
|
+
return default if input.empty? && !default.nil?
|
28
|
+
|
29
|
+
output.puts "Invalid choice"
|
30
|
+
boolean(text, default: default)
|
28
31
|
end
|
29
32
|
|
30
33
|
def choice(text, options, nil_option: false)
|
@@ -53,10 +53,22 @@ module Abt
|
|
53
53
|
warn("Section is empty")
|
54
54
|
select_work_item
|
55
55
|
else
|
56
|
-
|
56
|
+
prompt_work_item(work_items) || select_work_item
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
+
def prompt_work_item(work_items)
|
61
|
+
options = work_items.map do |work_item|
|
62
|
+
{
|
63
|
+
"id" => work_item["id"],
|
64
|
+
"name" => "##{work_item['id']} #{work_item['name']}"
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
choice = cli.prompt.choice("Select a work item", options, nil_option: true)
|
69
|
+
choice && work_items.find { |work_item| work_item["id"] == choice["id"] }
|
70
|
+
end
|
71
|
+
|
60
72
|
def work_items_in_column(column)
|
61
73
|
work_items = api.work_item_query(
|
62
74
|
<<~WIQL
|
@@ -30,7 +30,7 @@ module Abt
|
|
30
30
|
|
31
31
|
def create_and_switch
|
32
32
|
warn("No such branch: #{branch_name}")
|
33
|
-
abort("Aborting") unless cli.prompt.boolean("Create branch?")
|
33
|
+
abort("Aborting") unless cli.prompt.boolean("Create branch?", default: true)
|
34
34
|
|
35
35
|
Open3.popen3("git switch -c #{branch_name}") do |_i, _o, _e, thread|
|
36
36
|
thread.value
|
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.25
|
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-03-
|
11
|
+
date: 2021-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-inflector
|