lit-cli 0.2.0 → 0.3.0
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.
- checksums.yaml +4 -4
- data/lib/config.rb +22 -6
- data/lib/lit_cli.rb +11 -11
- 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: 7da20adf8c48a70324edea2bbd6fd0ecce700d5963062517dbc3a966aab086be
|
4
|
+
data.tar.gz: f44d5c8433cfa2a640ea2d8785c742070d15ef5078fa131187c6a21c65bedec5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7cb6cf1c1095c166b91ad7b926b30fbb11635b31b2c54aeff776901f20c0ecfae54ebd2d03e88dc9b26a659c462692919cdd113989953e4f89367fa34cde7a0
|
7
|
+
data.tar.gz: 7b9938c6416e365a966e91bd659a7448a6ff31fd40ded6427e586ea5277c4d08f575e2f484ee888e4b008bd13f4b814d6f398b1d96bfd4240aaba296cf36b458
|
data/lib/config.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'set'
|
2
|
+
|
1
3
|
module LitCLI
|
2
4
|
|
3
5
|
##############################################################################
|
@@ -16,6 +18,9 @@ module LitCLI
|
|
16
18
|
|
17
19
|
class Config
|
18
20
|
|
21
|
+
# Track errors and only show them once.
|
22
|
+
@@errors = Set.new
|
23
|
+
|
19
24
|
attr_accessor :enabled
|
20
25
|
attr_accessor :types
|
21
26
|
attr_accessor :type
|
@@ -83,16 +88,27 @@ module LitCLI
|
|
83
88
|
end
|
84
89
|
end
|
85
90
|
|
86
|
-
@type = flags[:type] if flags.has_key? :type
|
87
91
|
@step = true if flags.has_key? :step
|
92
|
+
@type = Array(flags[:type]).map(&:to_sym) if valid? flags, :type
|
93
|
+
@delay = flags[:delay].to_f if valid? flags, :delay
|
94
|
+
end
|
88
95
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
96
|
+
def valid? flags, flag
|
97
|
+
# Has flag even been entered on the command line?
|
98
|
+
unless flags.has_key? flag
|
99
|
+
return false
|
100
|
+
end
|
101
|
+
|
102
|
+
if flags[flag].nil?
|
103
|
+
error = "🔥 ERROR: Invalid argument for @#{flag}."
|
104
|
+
unless @@errors.include? error
|
105
|
+
@@errors.add error
|
106
|
+
puts error
|
94
107
|
end
|
108
|
+
return false
|
95
109
|
end
|
110
|
+
|
111
|
+
true
|
96
112
|
end
|
97
113
|
|
98
114
|
end
|
data/lib/lit_cli.rb
CHANGED
@@ -7,7 +7,7 @@ module LitCLI
|
|
7
7
|
|
8
8
|
def lit(message, type = :info)
|
9
9
|
if @@config.enabled
|
10
|
-
filter
|
10
|
+
return if filter? type
|
11
11
|
render(type)
|
12
12
|
step()
|
13
13
|
delay()
|
@@ -27,16 +27,20 @@ module LitCLI
|
|
27
27
|
puts message
|
28
28
|
end
|
29
29
|
|
30
|
-
def filter(type)
|
31
|
-
if @@config.type
|
32
|
-
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
30
|
def step()
|
37
31
|
if @@config.step
|
32
|
+
puts "🔥 PRESS ENTER:"
|
33
|
+
input = gets.chomp
|
34
|
+
binding while input == nil
|
35
|
+
end
|
36
|
+
end
|
38
37
|
|
38
|
+
def filter? type
|
39
|
+
unless @@config.type.nil? || @@config.type.include?(type)
|
40
|
+
return true
|
39
41
|
end
|
42
|
+
|
43
|
+
false
|
40
44
|
end
|
41
45
|
|
42
46
|
def delay()
|
@@ -72,8 +76,4 @@ module LitCLI
|
|
72
76
|
@@config.cli_configure()
|
73
77
|
end
|
74
78
|
|
75
|
-
def self.error(message)
|
76
|
-
puts "🔥 ERROR: #{message}"
|
77
|
-
end
|
78
|
-
|
79
79
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lit-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maedi Prichard
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
description:
|
27
|
+
description: Console logs that are only visible after prefixing a process with `lit`
|
28
28
|
email: maediprichard@gmail.com
|
29
29
|
executables:
|
30
30
|
- lit
|