masked-pass 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -0
  3. data/bin/masked-pass +45 -9
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a5374d1c5a82105258e35b4b2c9ef995603473fb40955c793cf8d26a02698239
4
- data.tar.gz: f0e675735093ec232f6766c098c88fc2f1c0aa8606ef607a67006cf8afe0445c
3
+ metadata.gz: 32657b06985233183a4bfe730903f9edfa950aba1147ca93dcaed3e4f0aef5ae
4
+ data.tar.gz: 6f82a0c75b42c391f69ca21d02b99c56c0c6256b720ac55a7461852e1425f22b
5
5
  SHA512:
6
- metadata.gz: b1055666d06466d7d531dc1cd42b1327b7dbdb644f19f0271a8aa79b9fc0dc1bcf57920589b2ea49def6465b111e2303c53f026ddfbec8b8c24546a142ef604b
7
- data.tar.gz: e421e6f54a93888d2388407a848aace1a975f680b8a633008a9c412acab0190d6f8e5762a3bcdab6b1df4246752218d5eca2f31b26a5a5de0a3056d275c9a939
6
+ metadata.gz: f5359b0affa3f58f59e29c77f3feb53f94f861203f26575a386cc96fdfbbf6cec322f31528205497cebed971547fc52b96c20b9cf17135961badb5dd8e817877
7
+ data.tar.gz: 8ef9ec980da1d4b6a08c4fd1793c0ddfae4b2f98cb7923d4b5dfbd6b8853b9883bb937ed4ebd1f33f6d9bc15a6b2a4d88827d2122a01a37fed2273dbd0c3ba13
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.2.0
data/bin/masked-pass CHANGED
@@ -2,14 +2,50 @@
2
2
 
3
3
  require 'io/console'
4
4
 
5
- puts 'Character indexes:'
6
- indexes = STDIN.gets.chomp.split(/\s|,/).map(&:to_i)
5
+ def read_indexes
6
+ STDIN.gets.chomp.split(/\s|,/).map(&:to_i)
7
+ end
7
8
 
8
- puts 'Now paste the password'
9
- pass = STDIN.noecho(&:gets).chomp
9
+ def masked_chars(pass, indexes)
10
+ indexes.map { |i| pass[i-1] }
11
+ end
10
12
 
11
- puts 'Your characters:'
12
- chars_string = indexes.map { |i| pass[i-1] }.join(' ')
13
- print chars_string
14
- sleep 10
15
- puts "\r#{'*' * chars_string.size}"
13
+ if ARGV.include?('-v') || ARGV.include?('--version')
14
+ version = File.read(File.expand_path('../VERSION', File.dirname(__FILE__)))
15
+ puts "masked-pass #{version}"
16
+ exit
17
+ end
18
+
19
+ if ARGV.include?('-h') || ARGV.include?('--help')
20
+ puts <<~HELP
21
+ Usage:
22
+ masked-pass [options]
23
+
24
+ Options:
25
+ -v, --version Show version and exit
26
+ -h, --help Show help message and exit
27
+ -c, --clipboard Use clipboard for input and output (MacOS only)
28
+ HELP
29
+ exit
30
+ end
31
+
32
+ if ARGV.include?('-c') || ARGV.include?('--clipboard')
33
+ puts 'Copy password to clipboard then type character indexes:'
34
+ indexes = read_indexes
35
+ pass = `pbpaste`
36
+ chars = masked_chars(pass, indexes)
37
+ chars_string = chars.join
38
+ system("echo '#{chars_string}\\c' | pbcopy")
39
+ puts 'Characters copied to clipboard'
40
+ else
41
+ puts 'Character indexes:'
42
+ indexes = read_indexes
43
+ puts 'Now paste the password'
44
+ pass = STDIN.noecho(&:gets).chomp
45
+ puts 'Your characters:'
46
+ chars = masked_chars(pass, indexes)
47
+ chars_string = chars.join(' ')
48
+ print chars_string
49
+ sleep 10
50
+ puts "\r#{'*' * chars_string.size}"
51
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: masked-pass
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marek Mateja
@@ -18,6 +18,7 @@ executables:
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
+ - VERSION
21
22
  - bin/masked-pass
22
23
  homepage: https://github.com/mmateja/masked-pass
23
24
  licenses:
@@ -38,8 +39,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
38
39
  - !ruby/object:Gem::Version
39
40
  version: '0'
40
41
  requirements: []
41
- rubyforge_project:
42
- rubygems_version: 2.7.6
42
+ rubygems_version: 3.0.3.1
43
43
  signing_key:
44
44
  specification_version: 4
45
45
  summary: Small program helping with masked passwords