use_packs 0.0.2 → 0.0.3

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: e12528c58342f14ac6b85143222c121a415baf025dbce4bf46349b60c5a1a726
4
- data.tar.gz: e59faa92e2e6eab2e0967cd46cba1ba7bb1aade8957f55a40656571ea3431bbc
3
+ metadata.gz: '006912f2bf892c63364fba8ae22cb6202df72e8fe9bd2a081c8cf5d3610d0fb2'
4
+ data.tar.gz: 3b4510070e1f6160d8814fe5fea8947481330f8ca05c4bb995bf075930a21454
5
5
  SHA512:
6
- metadata.gz: 31f76e50ac922c3968066db9f7744922cb36f8fce69ace812d7b98b6af5488257c3efa5b9a12190854d88959a2b7ad6573c97847a3c364c5e4adc29740eb39c5
7
- data.tar.gz: 2b3fce71ffb916a7c40392e8bbdcb2533819c3825245f0e29f1fa910e42cd5a2dc8fda16c8ddf4d5c6a6d69af22ef87176d7c5de5a715613b79b600664ea7d58
6
+ metadata.gz: d685dbd8cc145544a1c5c1116f3ba39f23d9feda347701657eea97a7e44b44a57f778ad452d719d2442edf33c79a8211451a14367624c9a39f6be77d5af23e49
7
+ data.tar.gz: 25d3c0d781b77ba831ede9f7a01124fd2bdede9737e4d9b0645d2a5080c132d397dd5fcbdc60d2121a22cc556e4cb0256f38d3460e43b07ac2a12c1f09ad7ec9
@@ -7,26 +7,47 @@ module UsePacks
7
7
  extend T::Sig
8
8
 
9
9
  sig { params(prompt: TTY::Prompt, question_text: String).returns(ParsePackwerk::Package) }
10
- def self.single_pack_select(prompt, question_text: 'Please select a pack')
10
+ def self.single_pack_select(prompt, question_text: 'Please use space to select a pack')
11
11
  packs = ParsePackwerk.all.to_h { |t| [t.name, t] }
12
- prompt.select(
12
+
13
+ pack_selection = T.let(prompt.select(
13
14
  question_text,
14
15
  packs,
15
16
  filter: true,
16
17
  per_page: 10,
17
18
  show_help: :always
18
- )
19
+ ), T.nilable(ParsePackwerk::Package))
20
+
21
+ while pack_selection.nil?
22
+ prompt.error(
23
+ 'No packs were selected, please select a pack using the space key before pressing enter.'
24
+ )
25
+
26
+ pack_selection = single_pack_select(prompt, question_text: question_text)
27
+ end
28
+
29
+ pack_selection
19
30
  end
20
31
 
21
32
  sig { params(prompt: TTY::Prompt, question_text: String).returns(T::Array[ParsePackwerk::Package]) }
22
- def self.single_or_all_pack_multi_select(prompt, question_text: 'Please select one or more packs')
23
- prompt.multi_select(
33
+ def self.single_or_all_pack_multi_select(prompt, question_text: 'Please use space to select one or more packs')
34
+ pack_selection = T.let(prompt.multi_select(
24
35
  question_text,
25
36
  ParsePackwerk.all.to_h { |t| [t.name, t] },
26
37
  filter: true,
27
38
  per_page: 10,
28
39
  show_help: :always
29
- )
40
+ ), T::Array[ParsePackwerk::Package])
41
+
42
+ while pack_selection.empty?
43
+ prompt.error(
44
+ 'No packs were selected, please select one or more packs using the space key before pressing enter.'
45
+ )
46
+
47
+ pack_selection = single_or_all_pack_multi_select(prompt, question_text: question_text)
48
+ end
49
+
50
+ pack_selection
30
51
  end
31
52
  end
32
53
  end
@@ -7,27 +7,49 @@ module UsePacks
7
7
  extend T::Sig
8
8
 
9
9
  sig { params(prompt: TTY::Prompt, question_text: String).returns(CodeTeams::Team) }
10
- def self.single_select(prompt, question_text: 'Please select a team owner')
10
+ def self.single_select(prompt, question_text: 'Please use space to select a team owner')
11
11
  teams = CodeTeams.all.sort_by(&:name).to_h { |t| [t.name, t] }
12
- prompt.select(
12
+
13
+ team_selection = T.let(prompt.select(
13
14
  question_text,
14
15
  teams,
15
16
  filter: true,
16
17
  per_page: 10,
17
18
  show_help: :always
18
- )
19
+ ), T.nilable(CodeTeams::Team))
20
+
21
+ while team_selection.nil?
22
+ prompt.error(
23
+ 'No owners were selected, please select an owner using the space key before pressing enter.'
24
+ )
25
+
26
+ team_selection = single_select(prompt, question_text: question_text)
27
+ end
28
+
29
+ team_selection
19
30
  end
20
31
 
21
32
  sig { params(prompt: TTY::Prompt, question_text: String).returns(T::Array[CodeTeams::Team]) }
22
- def self.multi_select(prompt, question_text: 'Please select team owners')
33
+ def self.multi_select(prompt, question_text: 'Please use space to select team owners')
23
34
  teams = CodeTeams.all.to_h { |t| [t.name, t] }
24
- prompt.multi_select(
35
+
36
+ team_selection = T.let(prompt.multi_select(
25
37
  question_text,
26
38
  teams,
27
39
  filter: true,
28
40
  per_page: 10,
29
41
  show_help: :always
30
- )
42
+ ), T::Array[CodeTeams::Team])
43
+
44
+ while team_selection.empty?
45
+ prompt.error(
46
+ 'No owners were selected, please select one or more owners using the space key before pressing enter.'
47
+ )
48
+
49
+ team_selection = multi_select(prompt, question_text: question_text)
50
+ end
51
+
52
+ team_selection
31
53
  end
32
54
  end
33
55
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: use_packs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gusto Engineers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-09 00:00:00.000000000 Z
11
+ date: 2022-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: code_ownership