lit-cli 0.0.3 → 0.1.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/bin/lit +16 -1
- data/lib/config.rb +18 -0
- data/lib/lit_cli.rb +46 -0
- metadata +4 -3
- data/lib/api.rb +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a459079c92763142e2a67ca0edfadecfc1ed5e0755ad5c89bba8f6806c923541
|
4
|
+
data.tar.gz: 6cbaca173d279eb5d60b361cf03a075f760045913d2c8f756913db37a1b2b9fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eef119aa4d3711abddea64974001c946135eba964d06886c8b2a49344b90868aef87079b1c4b293a6af2df8b1f83997ab80596655272c7e581a5d5a59b88d3ac
|
7
|
+
data.tar.gz: 2a8a974813a2c013b16f8830a3bd3670d5bbbf1a03d881bd69587b7ae8f4692681f248e2971aeec45581c35439a1f9b6d95f96472a7989ed19cbaa313e2a103c
|
data/bin/lit
CHANGED
@@ -11,6 +11,21 @@
|
|
11
11
|
# Enable Lit API.
|
12
12
|
ENV['LIT_ENABLED'] = 'true'
|
13
13
|
|
14
|
+
args = []
|
15
|
+
flags = []
|
16
|
+
|
17
|
+
# Get flags from arguments.
|
18
|
+
ARGV.each do |arg|
|
19
|
+
if arg.start_with? '@'
|
20
|
+
flags << arg.delete_prefix('@')
|
21
|
+
else
|
22
|
+
args << arg
|
23
|
+
end
|
24
|
+
end
|
25
|
+
ENV['LIT_FLAGS'] = flags.join " "
|
26
|
+
|
27
|
+
# Get user input.
|
28
|
+
command = args.join " "
|
29
|
+
|
14
30
|
# Action original command.
|
15
|
-
command = ARGV.join " "
|
16
31
|
system command
|
data/lib/config.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
module LitCLI
|
2
|
+
class Config
|
3
|
+
|
4
|
+
attr_accessor :types
|
5
|
+
|
6
|
+
def initialize()
|
7
|
+
@types = {
|
8
|
+
:info => { icon: "ℹ", color: :blue },
|
9
|
+
:pass => { icon: "✔", color: :green },
|
10
|
+
:warn => { icon: "⚠", color: :yellow },
|
11
|
+
:fail => { icon: "⨯", color: :red },
|
12
|
+
:error => { icon: "!", color: :red },
|
13
|
+
:debug => { icon: "?", color: :purple },
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
data/lib/lit_cli.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'pastel'
|
2
|
+
require 'config'
|
3
|
+
|
4
|
+
module LitCLI
|
5
|
+
|
6
|
+
@@pastel = Pastel.new
|
7
|
+
@@config = Config.new()
|
8
|
+
|
9
|
+
def lit(message, type = :info)
|
10
|
+
if ENV['LIT_ENABLED'] == 'true'
|
11
|
+
type_config = @@config.types[type]
|
12
|
+
|
13
|
+
time_text = LitCLI.colorize(Time.now().strftime("%k:%M"), :cyan)
|
14
|
+
type_text = type_config[:icon] + " " + type.to_s
|
15
|
+
type_text_color = LitCLI.colorize(type_text, type_config[:color])
|
16
|
+
|
17
|
+
message = "🔥 #{time_text} #{type_text_color} #{message}"
|
18
|
+
puts message
|
19
|
+
end
|
20
|
+
end
|
21
|
+
alias 🔥 lit
|
22
|
+
|
23
|
+
def self.colorize(text, color)
|
24
|
+
case color
|
25
|
+
when :blue
|
26
|
+
return @@pastel.bright_blue(text)
|
27
|
+
when :green
|
28
|
+
return @@pastel.green(text)
|
29
|
+
when :yellow
|
30
|
+
return @@pastel.yellow(text)
|
31
|
+
when :red
|
32
|
+
return @@pastel.red(text)
|
33
|
+
when :purple, :magenta
|
34
|
+
return @@pastel.magenta(text)
|
35
|
+
when :cyan
|
36
|
+
return @@pastel.cyan(text)
|
37
|
+
else
|
38
|
+
return text
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.configure
|
43
|
+
yield(@@config)
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lit-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maedi Prichard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pastel
|
@@ -32,7 +32,8 @@ extensions: []
|
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
34
|
- bin/lit
|
35
|
-
- lib/
|
35
|
+
- lib/config.rb
|
36
|
+
- lib/lit_cli.rb
|
36
37
|
homepage: https://reflekt.dev/lit
|
37
38
|
licenses:
|
38
39
|
- MPL-2.0
|
data/lib/api.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
# TODO: Define environment variable in parent process, not just child process.
|
2
|
-
# ENV['LIT_SUPPORTED'] = 'true'
|
3
|
-
|
4
|
-
require 'pastel'
|
5
|
-
|
6
|
-
module LitAPI
|
7
|
-
|
8
|
-
@@pastel = Pastel.new
|
9
|
-
|
10
|
-
def lit(message, status = :info)
|
11
|
-
|
12
|
-
if ENV['LIT_ENABLED'] == 'true'
|
13
|
-
|
14
|
-
time = Time.now().strftime("%k:%M")
|
15
|
-
status_style = status.to_s.upcase
|
16
|
-
status_icons = {
|
17
|
-
:info => "ℹ",
|
18
|
-
:pass => "✔",
|
19
|
-
:fail => "⨯"
|
20
|
-
}
|
21
|
-
|
22
|
-
message = "🔥 #{time}: #{message} (#{status_icons[status]} #{status_style})"
|
23
|
-
|
24
|
-
case status
|
25
|
-
when :info
|
26
|
-
puts @@pastel.bright_blue(message)
|
27
|
-
when :pass, :success
|
28
|
-
puts @@pastel.green(message)
|
29
|
-
when :fail
|
30
|
-
puts @@pastel.red(message)
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|