simple-cli 0.2.10 → 0.2.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +27 -0
- data/Gemfile.lock +2 -2
- data/lib/simple/cli/logger/adapter.rb +9 -3
- data/lib/simple/cli/logger/colored_logger.rb +10 -6
- data/lib/simple/cli/pp.rb +2 -0
- data/lib/simple/cli/runner.rb +1 -1
- data/lib/simple/cli/runner/autocompletion.rb +1 -1
- data/lib/simple/cli/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0f1c16037299ca7f383eb093ad4b6c238c242a99d7a1025c12fd3e6a9072e8c6
|
4
|
+
data.tar.gz: 4a5884aea0b768e946466dc6d38ec72cbcc1952d10cc8d67aad51d63b05073aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22e37371acf5ab7141051adf9c111859d24c68903bfc5a01cc8a1e2a7fd93bbd3bd505c451f73a9836ba9819a3bf0ce8050f4b88e0dad0969c37709cfeb13a52
|
7
|
+
data.tar.gz: 52aa6a48f7b9c7483576590b4418242f9d6f10ec24e6b7fcea227274ef0dc727ec521a2e4deeadef2ff2686d3979a77e82e0e45e3ae8aa0f38c5ee377e77ed2f
|
data/.rubocop.yml
CHANGED
@@ -42,3 +42,30 @@ Lint/MissingCopEnableDirective:
|
|
42
42
|
|
43
43
|
Style/RegexpLiteral:
|
44
44
|
Enabled: false
|
45
|
+
|
46
|
+
Style/PercentLiteralDelimiters:
|
47
|
+
Enabled: false
|
48
|
+
|
49
|
+
Style/FormatStringToken:
|
50
|
+
Enabled: false
|
51
|
+
|
52
|
+
Style/IfUnlessModifier:
|
53
|
+
Enabled: false
|
54
|
+
|
55
|
+
Style/ParallelAssignment:
|
56
|
+
Enabled: false
|
57
|
+
|
58
|
+
Style/FormatString:
|
59
|
+
Enabled: false
|
60
|
+
|
61
|
+
Style/SymbolArray:
|
62
|
+
Enabled: false
|
63
|
+
|
64
|
+
Layout/SpaceInsideArrayLiteralBrackets:
|
65
|
+
Enabled: false
|
66
|
+
|
67
|
+
Style/TrailingCommaInLiteral:
|
68
|
+
Enabled: false
|
69
|
+
|
70
|
+
Performance/Caller:
|
71
|
+
Enabled: false
|
data/Gemfile.lock
CHANGED
@@ -1,11 +1,15 @@
|
|
1
|
+
# rubocop:disable Metrics/AbcSize
|
2
|
+
# rubocop:disable Metrics/MethodLength
|
3
|
+
|
1
4
|
class Simple::CLI::Logger::Adapter
|
2
5
|
def initialize(logger)
|
3
6
|
@logger = logger
|
4
7
|
end
|
5
8
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
+
LOGGER_METHODS = [ :debug, :info, :warn, :error, :fatal, :level, :level= ]
|
10
|
+
|
11
|
+
extend Forwardable
|
12
|
+
delegate LOGGER_METHODS => :@logger
|
9
13
|
|
10
14
|
def success(msg, *args, &block)
|
11
15
|
if @logger.respond_to?(:success)
|
@@ -16,6 +20,8 @@ class Simple::CLI::Logger::Adapter
|
|
16
20
|
end
|
17
21
|
|
18
22
|
def benchmark(msg, *args, &block)
|
23
|
+
_ = block
|
24
|
+
|
19
25
|
severity = :warn
|
20
26
|
if msg.is_a?(Symbol)
|
21
27
|
severity, msg = msg, args.shift
|
@@ -1,7 +1,10 @@
|
|
1
|
+
# rubocop:disable Metrics/AbcSize
|
2
|
+
# rubocop:disable Metrics/MethodLength
|
3
|
+
|
1
4
|
module Simple::CLI::Logger::ColoredLogger
|
2
5
|
extend self
|
3
6
|
|
4
|
-
|
7
|
+
attr_accessor :level
|
5
8
|
|
6
9
|
COLORS = {
|
7
10
|
clear: "\e[0m", # Embed in a String to clear all previous ANSI sequences.
|
@@ -25,13 +28,14 @@ module Simple::CLI::Logger::ColoredLogger
|
|
25
28
|
on_white: "\e[47m" # Set the terminal's background ANSI color to white.
|
26
29
|
}
|
27
30
|
|
31
|
+
# rubocop:disable Style/ClassVars
|
28
32
|
@@started_at = Time.now
|
29
33
|
|
30
34
|
MESSAGE_COLOR = {
|
31
|
-
:
|
32
|
-
:
|
33
|
-
:
|
34
|
-
:
|
35
|
+
info: :cyan,
|
36
|
+
warn: :yellow,
|
37
|
+
error: :red,
|
38
|
+
success: :green,
|
35
39
|
}
|
36
40
|
|
37
41
|
def debug(msg, *args)
|
@@ -77,7 +81,7 @@ module Simple::CLI::Logger::ColoredLogger
|
|
77
81
|
|
78
82
|
msg_length = msg.length
|
79
83
|
|
80
|
-
if color = COLORS[MESSAGE_COLOR[sym]]
|
84
|
+
if (color = COLORS[MESSAGE_COLOR[sym]])
|
81
85
|
msg = "#{color}#{msg}#{COLORS[:clear]}"
|
82
86
|
end
|
83
87
|
|
data/lib/simple/cli/pp.rb
CHANGED
data/lib/simple/cli/runner.rb
CHANGED
@@ -36,7 +36,7 @@ module Simple::CLI::Runner::Autocompletion
|
|
36
36
|
if subcommand == "help"
|
37
37
|
completions = commands.map(&:to_s).map { |s| s.tr("_", ":") } + ["autocomplete"]
|
38
38
|
filter_completions completions, prefix: cur
|
39
|
-
elsif cur && cur[0,1] == "-"
|
39
|
+
elsif cur && cur[0, 1] == "-"
|
40
40
|
completions = CommandHelp.option_names(@app, string_to_command(subcommand))
|
41
41
|
completions += DEFAULT_OPTIONS
|
42
42
|
|
data/lib/simple/cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- radiospiel
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-09-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
version: '0'
|
116
116
|
requirements: []
|
117
117
|
rubyforge_project:
|
118
|
-
rubygems_version: 2.
|
118
|
+
rubygems_version: 2.7.6
|
119
119
|
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: Simple CLI builder for ruby
|