micromenu 0.0.1 → 0.0.2

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/bin/um +12 -10
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b99abda368b7653a9d096fd6af0d233872fdc0f54ae85014ead92d2e6a52d48
4
- data.tar.gz: 5e09c5b87776f10ee220c751e6fa66e52a10d9ab73b5bad8eac672be64a7dddd
3
+ metadata.gz: e8110a88cf939a9561fb6d835016144262e241c92bfc93f5438324205f5c4e80
4
+ data.tar.gz: d41cbbfbc078055e2320c0f9464c1c83a5e6d158173d09f17e32a92385b178f2
5
5
  SHA512:
6
- metadata.gz: e87da796498d324701d418854371385aec6b2c5fad7a75f7d9b0b64bff88df1847093b281558a5d0391c06ae243b3053694ea555a384bc7c0902efc1f80d57e0
7
- data.tar.gz: c0edf467e14dcf99a3152cbb9588a72a7a7920a87eeedf46f63b0ea775e11187f367c9d800838b8836c82d47835e77b4a6a8f44a30f5bccb982183c2b497a32e
6
+ metadata.gz: 6616c5d4307c686f2a88e8e75262a2b19d515c3711e21da24c1e257a04783010fce6156d2b9b5c4c00978d733dd19781f53a64a016a52d3588b8ffc18eca855f
7
+ data.tar.gz: 18b6eb6a18d2078d4dd6451d6611cd4fa23fabb9ad097b66bfeee01989ca4aefcea919a668c4f6ae5b0e06780c7400d6b6101be043c21d765de20e895f0f6c77
data/bin/um CHANGED
@@ -4,8 +4,8 @@ require 'tty-prompt'
4
4
 
5
5
  home = Dir.getwd
6
6
 
7
- if ARGV.length > 0
8
- # if the first argument looks like something other than a string
7
+ if ARGV.length.positive?
8
+ # if the first argument looks like something other than a number
9
9
  if ARGV[0].to_i.to_s != ARGV[0]
10
10
  dir = ARGV.shift
11
11
  Dir.chdir dir
@@ -33,21 +33,23 @@ def prompt
33
33
  end
34
34
  end
35
35
 
36
+ def show_prompt(options)
37
+ help = "(Use ↑/↓ arrow keys or numbers to select)"
38
+ prompt.select('Select an action:', options, enum: ')', cycle: true, help: help)
39
+ rescue TTY::Reader::InputInterrupt
40
+ bye
41
+ end
42
+
36
43
  def choose(options)
37
- if ARGV.length > 0
44
+ if ARGV.length.positive?
38
45
  ARGV.shift
39
46
  else
40
- begin
41
- help = "(Use ↑/↓ arrow keys or numbers to select)"
42
- prompt.select('Select an action:', options, enum: ')', cycle: true, help: help)
43
- rescue TTY::Reader::InputInterrupt
44
- bye
45
- end
47
+ show_prompt(options)
46
48
  end
47
49
  end
48
50
 
49
51
  def args
50
- if ARGV.length > 0
52
+ if ARGV.length.positive?
51
53
  ARGV
52
54
  else
53
55
  prompt.ask('Arguments:')&.split || []
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: micromenu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tristan Penman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-13 00:00:00.000000000 Z
11
+ date: 2022-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-prompt