atk_toolbox 0.0.3 → 0.0.4

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/atk/cmd.rb +37 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b085c0c6b1f5109a99966a5828ede775cfa553a90b59097a81ab43742968feca
4
- data.tar.gz: 572848c31e6649a461a59832882ab9b6a6309d8e10b928eaec8b3f665e1a5453
3
+ metadata.gz: 0d964a5f967172531ef2a23d40319702f0f797d68aa98e8edc74388822c427e1
4
+ data.tar.gz: 8833017e32e64592a6631507cc28d5f7a94837030ebb5c78c3434f882fd375aa
5
5
  SHA512:
6
- metadata.gz: 1f3c3f88220d28d6ad10dc69b79e6a2f987f4f275ce1ed1d499f99eed4cbec0f1e17ab0426be2d970c61b822aaa8b81f49d93bb171763eac2c594303a6c5dc82
7
- data.tar.gz: 2ac95b4eb4857fda2da309e5ddafad21114c3160c55c87c4724b3614535faaeaf4f46c7f05ff4813267ba6c7dbff32a29fe2411864d2f18ce06678549b2efab6
6
+ metadata.gz: 208563db733b06e4509b198567eee63666e54b002bb858e91a4257e22e147810c11f664dd8c62359d281b6df281811ed7d27326182621bbea803c3a89f444dfc
7
+ data.tar.gz: 43b86e89ebf073c2046aba914667e5b76ae52c250e530b05ffa6cbfcce24234af8ab6fa8442a9120bad6c45bd33e818b8cdbf5c052fa6530e35d0b25d316be62
data/lib/atk/cmd.rb CHANGED
@@ -1,7 +1,42 @@
1
+ #
2
+ # extract all the command line input so STDIN can be used
3
+ #
4
+ def commandline_args()
5
+ the_args = []
6
+ for each in ARGV
7
+ the_args << each
8
+ end
9
+ ARGV.clear
10
+ return the_args
11
+ end
12
+
13
+ # easy access to the commandline
1
14
  class String
2
15
  # add a - operator to strings that makes it behave like a system() call
3
16
  # but it shows stderr
4
17
  def -@
5
- return Process.wait(Process.spawn(self))
18
+ Process.wait(Process.spawn(self))
19
+ return $?
6
20
  end
7
- end
21
+ end
22
+
23
+
24
+ #
25
+ # Q&A Functions
26
+ #
27
+ def ask_yes_or_no(question)
28
+ loop do
29
+ puts question
30
+ case gets.chomp
31
+ when /\A\s*(yes|yeah|y)\z\s*/i
32
+ return true
33
+ when /\A\s*(no|nope|n)\z\s*/i
34
+ return false
35
+ when /\A\s*cancel\s*\z/i
36
+ raise 'user canceled yes or no question'
37
+ else
38
+ puts "Sorry, please answer 'yes', 'no', or 'cancel'"
39
+ end#case
40
+ end#loop
41
+ end#askYesOrNo
42
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atk_toolbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Hykin