lit-cli 0.7.0 → 0.8.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a7edc257dc260a2ad0eccff8e71eff6217b0e89fde2acd7ea127500cefc58afb
4
- data.tar.gz: 9f0726175f5f79794f96694e18bae016a819bffe66fed34226ad4ffa694adc1a
3
+ metadata.gz: d7d27ec65b3d6ead4109e2ec4509c30ad071645bb2f0cac4b8e9fd0ee27e1e2e
4
+ data.tar.gz: efd72529bd96e50d8e286ab9cf3fe610e6077728282a15bd640c5195d15a8562
5
5
  SHA512:
6
- metadata.gz: 323f05467ab8cfa3c23d51fae4a738be4382e7a8d5bad44d9d9a2efc0376d6c139ee970792b35a9749226b913e308556209592d2ffb87318c14a6e6ae272d5b0
7
- data.tar.gz: facde086d4de3198fbfef692367d4cb31be51e26445ea6527d4f31c6084872e3283d8d43c2c43569b33ac879c7ff764ab2c3281a593474eb6ba46d0829744991
6
+ metadata.gz: c5ab9a686068313a84c120a354303ccdc2d9d24db4e6eafaf0ea45c9adedf8b59952b0503f52268b5765b45a5bb1f0bc0800d0b199d770a3f87b9c90e4d1b700
7
+ data.tar.gz: 548cb66165d4f9b9b396dbd7e2d554008d7450d2bafadfdb13a8fe19b61b104bf80428d1ae3c90120bc368bf8ce4d84484594237f82929bd37f8712797c7fe71
data/lib/config.rb CHANGED
@@ -53,9 +53,6 @@ module LitCLI
53
53
  # Flag defaults when not supplied via command line.
54
54
  ##
55
55
 
56
- # Boolean on whether or not to step through each lit() breakpoint.
57
- @step = false
58
-
59
56
  # Array of statuses to filter by, for example: [:warn, :error, :fail]
60
57
  @status = nil
61
58
 
@@ -65,6 +62,14 @@ module LitCLI
65
62
  # Integer or float representing amount of seconds to delay each lit() by.
66
63
  @delay = 0
67
64
 
65
+ ##
66
+ # PRIVATE.
67
+ ##
68
+
69
+ # Boolean on whether or not to step through each lit() breakpoint.
70
+ # Setting to true here wont enable Pry, best to enable via command line.
71
+ @step = false
72
+
68
73
  cli_configure()
69
74
  end
70
75
 
@@ -72,7 +77,7 @@ module LitCLI
72
77
  def cli_configure()
73
78
 
74
79
  # Enable lit via the command line.
75
- @enabled = true if ENV['LIT_ENABLED'].to_i >= (Time.now.to_i() - 1)
80
+ @enabled = true if ENV['LIT_ENABLED'] && ENV['LIT_ENABLED'].to_i >= (Time.now.to_i() - 1)
76
81
  return unless @enabled
77
82
 
78
83
  # Convert flag string to hash.
data/lib/lit_cli.rb CHANGED
@@ -13,9 +13,9 @@ module LitCLI
13
13
  return if LitCLI.filter_status? status
14
14
  return if LitCLI.filter_type? type
15
15
 
16
- LitCLI.render(message, status, type, context)
16
+ indent = LitCLI.render(message, status, type, context)
17
17
 
18
- LitCLI.step()
18
+ LitCLI.step(indent)
19
19
  yield if block_given?
20
20
 
21
21
  LitCLI.delay()
@@ -47,7 +47,7 @@ module LitCLI
47
47
  # Context.
48
48
  output << LitCLI.format(" #{context}", styles: [:bold, :dim])
49
49
 
50
- # Message.
50
+ # Line break.
51
51
  while message.start_with?('^')
52
52
  message.delete_prefix!('^').strip!
53
53
  unless @@config.status || @@config.type
@@ -55,20 +55,34 @@ module LitCLI
55
55
  end
56
56
  end
57
57
 
58
+ # Indent.
59
+ indent = ''
58
60
  while message.start_with?('>')
59
61
  message.delete_prefix!('>').strip!
60
62
  unless @@config.status || @@config.type
63
+ indent = indent + ' '
61
64
  output = ' ' + output
62
65
  end
63
66
  end
64
67
 
65
- output << " #{message}"
66
- puts output
68
+ # Highlight numbers and methods.
69
+ words = []
70
+ message.split(/(#\d+|\w+\(\))/).each do |word|
71
+ if word.start_with?('#') || word.end_with?(')')
72
+ words << @@pastel.yellow(word)
73
+ else
74
+ words << word
75
+ end
76
+ end
77
+
78
+ puts output << " " + words.join()
79
+
80
+ return indent
67
81
  end
68
82
 
69
- def self.step()
83
+ def self.step(indent)
70
84
  if @@config.step
71
- puts "🔥 Press ENTER to step or P to Pry:"
85
+ puts "#{indent}🔥 Press ENTER to step or P to Pry:"
72
86
  input = gets.chomp
73
87
  binding while input == nil
74
88
  @@is_prying = true if input.downcase == "p"
data/lib/lit_pry.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # Only override kernel methods when Lit's @step flag is true.
2
- if ENV['LIT_FLAGS'] && ENV['LIT_FLAGS'].include?('step')
2
+ if ENV['LIT_ENABLED'] && ENV['LIT_ENABLED'].to_i >= (Time.now.to_i() - 1) && ENV['LIT_FLAGS'] && ENV['LIT_FLAGS'].include?('step')
3
3
  require 'set'
4
4
 
5
5
  # TODO: Investigate RubyGems `require` before overriding.
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.7.0
4
+ version: 0.8.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-13 00:00:00.000000000 Z
11
+ date: 2021-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pastel