rfix 1.4.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/rfix +78 -34
- data/lib/rfix.rb +17 -28
- data/lib/rfix/branch.rb +3 -25
- data/lib/rfix/branch/base.rb +27 -0
- data/lib/rfix/branch/head.rb +15 -0
- data/lib/rfix/branch/main.rb +33 -0
- data/lib/rfix/branch/name.rb +21 -0
- data/lib/rfix/branch/reference.rb +15 -0
- data/lib/rfix/branch/upstream.rb +17 -0
- data/lib/rfix/cli/command.rb +19 -0
- data/lib/rfix/cli/command/base.rb +61 -0
- data/lib/rfix/cli/command/branch.rb +13 -0
- data/lib/rfix/cli/command/config.rb +22 -0
- data/lib/rfix/cli/command/extension.rb +25 -0
- data/lib/rfix/cli/command/help.rb +11 -0
- data/lib/rfix/cli/command/info.rb +11 -0
- data/lib/rfix/cli/command/lint.rb +17 -0
- data/lib/rfix/cli/command/local.rb +11 -0
- data/lib/rfix/cli/command/origin.rb +11 -0
- data/lib/rfix/cli/command/setup.rb +11 -0
- data/lib/rfix/error.rb +5 -1
- data/lib/rfix/extension/offense.rb +79 -0
- data/lib/rfix/extension/pastel.rb +11 -0
- data/lib/rfix/extension/string.rb +12 -0
- data/lib/rfix/extension/strings.rb +9 -0
- data/lib/rfix/file.rb +6 -41
- data/lib/rfix/file/base.rb +73 -0
- data/lib/rfix/file/deleted.rb +17 -0
- data/lib/rfix/file/ignored.rb +17 -0
- data/lib/rfix/file/tracked.rb +42 -0
- data/lib/rfix/file/untracked.rb +20 -0
- data/lib/rfix/formatter.rb +125 -86
- data/lib/rfix/highlighter.rb +118 -0
- data/lib/rfix/indicator.rb +19 -0
- data/lib/rfix/log.rb +12 -121
- data/lib/rfix/rake/gemfile.rb +111 -0
- data/lib/rfix/rake/paths.rb +25 -23
- data/lib/rfix/rake/support.rb +72 -57
- data/lib/rfix/repository.rb +114 -164
- data/lib/rfix/types.rb +52 -0
- data/lib/rfix/version.rb +1 -1
- data/rfix.gemspec +28 -38
- data/vendor/dry-cli/CHANGELOG.md +191 -0
- data/vendor/dry-cli/CODEOWNERS +1 -0
- data/vendor/dry-cli/CODE_OF_CONDUCT.md +13 -0
- data/vendor/dry-cli/CONTRIBUTING.md +29 -0
- data/vendor/dry-cli/Gemfile +14 -0
- data/vendor/dry-cli/Gemfile.devtools +18 -0
- data/vendor/dry-cli/LICENSE +20 -0
- data/vendor/dry-cli/README.md +29 -0
- data/vendor/dry-cli/Rakefile +13 -0
- data/vendor/dry-cli/bin/console +15 -0
- data/vendor/dry-cli/bin/setup +8 -0
- data/vendor/dry-cli/changelog.yml +97 -0
- data/vendor/dry-cli/docsite/source/arguments.html.md +57 -0
- data/vendor/dry-cli/docsite/source/callbacks.html.md +51 -0
- data/vendor/dry-cli/docsite/source/commands-with-subcommands-and-params.md +86 -0
- data/vendor/dry-cli/docsite/source/commands.html.md +41 -0
- data/vendor/dry-cli/docsite/source/index.html.md +302 -0
- data/vendor/dry-cli/docsite/source/options.html.md +51 -0
- data/vendor/dry-cli/docsite/source/subcommands.html.md +38 -0
- data/vendor/dry-cli/docsite/source/variadic-arguments.html.md +45 -0
- data/vendor/dry-cli/dry-cli.gemspec +36 -0
- data/vendor/dry-cli/lib/dry/cli.rb +224 -0
- data/vendor/dry-cli/lib/dry/cli/banner.rb +135 -0
- data/vendor/dry-cli/lib/dry/cli/command.rb +387 -0
- data/vendor/dry-cli/lib/dry/cli/command_registry.rb +253 -0
- data/vendor/dry-cli/lib/dry/cli/errors.rb +37 -0
- data/vendor/dry-cli/lib/dry/cli/inflector.rb +17 -0
- data/vendor/dry-cli/lib/dry/cli/inline.rb +75 -0
- data/vendor/dry-cli/lib/dry/cli/option.rb +131 -0
- data/vendor/dry-cli/lib/dry/cli/parser.rb +138 -0
- data/vendor/dry-cli/lib/dry/cli/program_name.rb +21 -0
- data/vendor/dry-cli/lib/dry/cli/registry.rb +338 -0
- data/vendor/dry-cli/lib/dry/cli/usage.rb +94 -0
- data/vendor/dry-cli/lib/dry/cli/version.rb +8 -0
- data/vendor/dry-cli/project.yml +13 -0
- data/vendor/dry-cli/spec/integration/commands_spec.rb +14 -0
- data/vendor/dry-cli/spec/integration/inherited_commands_spec.rb +24 -0
- data/vendor/dry-cli/spec/integration/inline_spec.rb +43 -0
- data/vendor/dry-cli/spec/integration/processes_errors_spec.rb +29 -0
- data/vendor/dry-cli/spec/integration/rendering_spec.rb +31 -0
- data/vendor/dry-cli/spec/integration/single_command_spec.rb +81 -0
- data/vendor/dry-cli/spec/integration/subcommands_spec.rb +60 -0
- data/vendor/dry-cli/spec/integration/third_party_gems_spec.rb +18 -0
- data/vendor/dry-cli/spec/spec_helper.rb +15 -0
- data/vendor/dry-cli/spec/support/coverage.rb +15 -0
- data/vendor/dry-cli/spec/support/files.rb +13 -0
- data/vendor/dry-cli/spec/support/fixtures/based +65 -0
- data/vendor/dry-cli/spec/support/fixtures/baz +9 -0
- data/vendor/dry-cli/spec/support/fixtures/baz_command.rb +19 -0
- data/vendor/dry-cli/spec/support/fixtures/foo +588 -0
- data/vendor/dry-cli/spec/support/fixtures/infinites +31 -0
- data/vendor/dry-cli/spec/support/fixtures/inline +20 -0
- data/vendor/dry-cli/spec/support/fixtures/registry.rb +15 -0
- data/vendor/dry-cli/spec/support/fixtures/shared_commands.rb +596 -0
- data/vendor/dry-cli/spec/support/fixtures/with_block.rb +86 -0
- data/vendor/dry-cli/spec/support/fixtures/with_registry.rb +90 -0
- data/vendor/dry-cli/spec/support/fixtures/with_zero_arity_block.rb +87 -0
- data/vendor/dry-cli/spec/support/helpers.rb +37 -0
- data/vendor/dry-cli/spec/support/path.rb +24 -0
- data/vendor/dry-cli/spec/support/rspec.rb +26 -0
- data/vendor/dry-cli/spec/support/rspec_options.rb +16 -0
- data/vendor/dry-cli/spec/support/shared_examples/commands.rb +300 -0
- data/vendor/dry-cli/spec/support/shared_examples/inherited_commands.rb +197 -0
- data/vendor/dry-cli/spec/support/shared_examples/rendering.rb +181 -0
- data/vendor/dry-cli/spec/support/shared_examples/subcommands.rb +226 -0
- data/vendor/dry-cli/spec/support/shared_examples/third_party_gems.rb +49 -0
- data/vendor/dry-cli/spec/support/warnings.rb +10 -0
- data/vendor/dry-cli/spec/unit/dry/cli/cli_spec.rb +123 -0
- data/vendor/dry-cli/spec/unit/dry/cli/inflector_spec.rb +26 -0
- data/vendor/dry-cli/spec/unit/dry/cli/registry_spec.rb +78 -0
- data/vendor/dry-cli/spec/unit/dry/cli/version_spec.rb +7 -0
- data/vendor/strings-ansi/CHANGELOG.md +24 -0
- data/vendor/strings-ansi/CODE_OF_CONDUCT.md +74 -0
- data/vendor/strings-ansi/Gemfile +11 -0
- data/{LICENSE.txt → vendor/strings-ansi/LICENSE.txt} +1 -1
- data/vendor/strings-ansi/README.md +155 -0
- data/vendor/strings-ansi/Rakefile +8 -0
- data/vendor/strings-ansi/appveyor.yml +32 -0
- data/vendor/strings-ansi/bin/console +14 -0
- data/vendor/strings-ansi/bin/setup +8 -0
- data/vendor/strings-ansi/lib/strings-ansi.rb +1 -0
- data/vendor/strings-ansi/lib/strings/ansi.rb +84 -0
- data/vendor/strings-ansi/lib/strings/ansi/extensions.rb +23 -0
- data/vendor/strings-ansi/lib/strings/ansi/version.rb +7 -0
- data/vendor/strings-ansi/spec/fixtures/ansi_codes.yaml +194 -0
- data/vendor/strings-ansi/spec/spec_helper.rb +51 -0
- data/vendor/strings-ansi/spec/unit/ansi_spec.rb +15 -0
- data/vendor/strings-ansi/spec/unit/extensions_spec.rb +19 -0
- data/vendor/strings-ansi/spec/unit/only_ansi_spec.rb +36 -0
- data/vendor/strings-ansi/spec/unit/sanitize_spec.rb +53 -0
- data/vendor/strings-ansi/strings-ansi.gemspec +34 -0
- data/vendor/strings-ansi/tasks/console.rake +11 -0
- data/vendor/strings-ansi/tasks/coverage.rake +11 -0
- data/vendor/strings-ansi/tasks/spec.rake +29 -0
- metadata +274 -188
- data/.github/workflows/main.yml +0 -26
- data/.gitignore +0 -43
- data/.rspec +0 -2
- data/.rubocop.yml +0 -87
- data/.travis.yml +0 -35
- data/Gemfile +0 -2
- data/Gemfile.base +0 -14
- data/Gemfile.base.lock +0 -172
- data/Gemfile.lock +0 -188
- data/Guardfile +0 -16
- data/Makefile +0 -12
- data/README.md +0 -85
- data/Rakefile +0 -31
- data/bin/bundle +0 -114
- data/bin/console +0 -29
- data/bin/guard +0 -29
- data/bin/rake +0 -29
- data/bin/rfix +0 -29
- data/bin/rspec +0 -29
- data/bin/setup +0 -29
- data/ci/Gemfile.rubocop-0.80 +0 -2
- data/ci/Gemfile.rubocop-0.80.lock +0 -170
- data/ci/Gemfile.rubocop-0.81 +0 -2
- data/ci/Gemfile.rubocop-0.81.lock +0 -170
- data/ci/Gemfile.rubocop-0.82 +0 -2
- data/ci/Gemfile.rubocop-0.82.lock +0 -170
- data/ci/Gemfile.rubocop-0.83 +0 -2
- data/ci/Gemfile.rubocop-0.83.lock +0 -168
- data/ci/Gemfile.rubocop-0.84 +0 -2
- data/ci/Gemfile.rubocop-0.84.lock +0 -171
- data/ci/Gemfile.rubocop-0.85 +0 -2
- data/ci/Gemfile.rubocop-0.85.1 +0 -2
- data/ci/Gemfile.rubocop-0.85.1.lock +0 -173
- data/ci/Gemfile.rubocop-0.85.lock +0 -173
- data/lib/rfix/box.rb +0 -112
- data/lib/rfix/branches/base.rb +0 -15
- data/lib/rfix/branches/head.rb +0 -13
- data/lib/rfix/branches/main.rb +0 -28
- data/lib/rfix/branches/name.rb +0 -23
- data/lib/rfix/branches/reference.rb +0 -21
- data/lib/rfix/branches/upstream.rb +0 -13
- data/lib/rfix/cmd.rb +0 -39
- data/lib/rfix/commands/branch.rb +0 -15
- data/lib/rfix/commands/extensions/options.rb +0 -8
- data/lib/rfix/commands/help.rb +0 -7
- data/lib/rfix/commands/helper/args.rb +0 -141
- data/lib/rfix/commands/helper/help.rb +0 -6
- data/lib/rfix/commands/helper/loader.rb +0 -6
- data/lib/rfix/commands/helper/option.rb +0 -0
- data/lib/rfix/commands/helper/params.rb +0 -0
- data/lib/rfix/commands/helper/rubocop.rb +0 -17
- data/lib/rfix/commands/info.rb +0 -30
- data/lib/rfix/commands/lint.rb +0 -22
- data/lib/rfix/commands/local.rb +0 -12
- data/lib/rfix/commands/origin.rb +0 -19
- data/lib/rfix/commands/setup.rb +0 -29
- data/lib/rfix/commands/welcome.rb +0 -24
- data/lib/rfix/deleted.rb +0 -13
- data/lib/rfix/extensions/extensions.rb +0 -18
- data/lib/rfix/extensions/offense.rb +0 -78
- data/lib/rfix/extensions/string.rb +0 -8
- data/lib/rfix/file_cache.rb +0 -59
- data/lib/rfix/git_helper.rb +0 -59
- data/lib/rfix/indentation.rb +0 -39
- data/lib/rfix/loader/bundler.rb +0 -37
- data/lib/rfix/loader/env.rb +0 -33
- data/lib/rfix/loader/spec.rb +0 -41
- data/lib/rfix/no_file.rb +0 -13
- data/lib/rfix/rfix.rb +0 -34
- data/lib/rfix/tracked.rb +0 -72
- data/lib/rfix/tracked_file.rb +0 -16
- data/lib/rfix/untracked.rb +0 -13
- data/resources/ps.png +0 -0
- data/tasks/bump.rake +0 -11
- data/tasks/bundle.rake +0 -17
- data/tasks/complex.rake +0 -54
- data/tasks/execute.rake +0 -38
- data/tasks/libgit2.rake +0 -33
- data/tasks/simple.rake +0 -62
- data/tasks/travis.rake +0 -74
- data/tasks/vendor.rake +0 -34
@@ -0,0 +1,32 @@
|
|
1
|
+
---
|
2
|
+
skip_commits:
|
3
|
+
files:
|
4
|
+
- "bin/**"
|
5
|
+
- "*.md"
|
6
|
+
install:
|
7
|
+
- SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
|
8
|
+
- gem install bundler -v '< 2.0'
|
9
|
+
- bundle install
|
10
|
+
before_test:
|
11
|
+
- ruby -v
|
12
|
+
- gem -v
|
13
|
+
- bundle -v
|
14
|
+
build: off
|
15
|
+
test_script:
|
16
|
+
- bundle exec rake ci
|
17
|
+
environment:
|
18
|
+
matrix:
|
19
|
+
- ruby_version: "200"
|
20
|
+
- ruby_version: "200-x64"
|
21
|
+
- ruby_version: "21"
|
22
|
+
- ruby_version: "21-x64"
|
23
|
+
- ruby_version: "22"
|
24
|
+
- ruby_version: "22-x64"
|
25
|
+
- ruby_version: "23"
|
26
|
+
- ruby_version: "23-x64"
|
27
|
+
- ruby_version: "24"
|
28
|
+
- ruby_version: "24-x64"
|
29
|
+
- ruby_version: "25"
|
30
|
+
- ruby_version: "25-x64"
|
31
|
+
- ruby_version: "26"
|
32
|
+
- ruby_version: "26-x64"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "strings/ansi"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
@@ -0,0 +1 @@
|
|
1
|
+
require_relative "strings/ansi"
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "ansi/version"
|
4
|
+
|
5
|
+
module Strings
|
6
|
+
# Helper functions for handling ANSI escape sequences
|
7
|
+
module ANSI
|
8
|
+
# The control sequence indicator
|
9
|
+
CSI = "\033"
|
10
|
+
|
11
|
+
# The code for reseting styling
|
12
|
+
RESET = "\e[0m"
|
13
|
+
|
14
|
+
# The regex to match ANSI codes
|
15
|
+
ANSI_MATCHER = %r{
|
16
|
+
(?>\033(
|
17
|
+
\[[\[?>!]?\d*(;\d+)*[ ]?[a-zA-Z~@$^\]_\{\\] # graphics
|
18
|
+
|
|
19
|
+
\#?\d # cursor modes
|
20
|
+
|
|
21
|
+
[)(%+\-*/. ](\d|[a-zA-Z@=%]|) # character sets
|
22
|
+
|
|
23
|
+
O[p-xA-Z] # special keys
|
24
|
+
|
|
25
|
+
[a-zA-Z=><~\}|] # cursor movement
|
26
|
+
|
|
27
|
+
\]8;[^;]*;.*?(\033\\|\07) # hyperlink
|
28
|
+
))
|
29
|
+
}x.freeze
|
30
|
+
|
31
|
+
# Return a copy of string with ANSI characters removed
|
32
|
+
#
|
33
|
+
# @param [String] string
|
34
|
+
#
|
35
|
+
# @example
|
36
|
+
# Strings::ANSI.sanitize("\e[33mfoo\[e0m")
|
37
|
+
# # => "foo"
|
38
|
+
#
|
39
|
+
# @return [String]
|
40
|
+
#
|
41
|
+
# @api public
|
42
|
+
def sanitize(string)
|
43
|
+
string.gsub(ANSI_MATCHER, "")
|
44
|
+
end
|
45
|
+
module_function :sanitize
|
46
|
+
|
47
|
+
# Check if string contains ANSI codes
|
48
|
+
#
|
49
|
+
# @param [String] string
|
50
|
+
# the string to check
|
51
|
+
#
|
52
|
+
# @example
|
53
|
+
# Strings::ANSI.ansi?("\e[33mfoo\[e0m")
|
54
|
+
# # => true
|
55
|
+
#
|
56
|
+
# @return [Boolean]
|
57
|
+
#
|
58
|
+
# @api public
|
59
|
+
def ansi?(string)
|
60
|
+
!!(string =~ ANSI_MATCHER)
|
61
|
+
end
|
62
|
+
module_function :ansi?
|
63
|
+
|
64
|
+
# Check if string contains only ANSI codes
|
65
|
+
#
|
66
|
+
# @param [String] string
|
67
|
+
# the string to check
|
68
|
+
#
|
69
|
+
# @example
|
70
|
+
# Strings::ANSI.only_ansi?("\e[33mfoo\[e0m")
|
71
|
+
# # => false
|
72
|
+
#
|
73
|
+
# Strings::ANSI.only_ansi?("\e[33m")
|
74
|
+
# # => false
|
75
|
+
#
|
76
|
+
# @return [Boolean]
|
77
|
+
#
|
78
|
+
# @api public
|
79
|
+
def only_ansi?(string)
|
80
|
+
!!(string =~ /\A(#{ANSI_MATCHER})+\z/)
|
81
|
+
end
|
82
|
+
module_function :only_ansi?
|
83
|
+
end # ANSI
|
84
|
+
end # Strings
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../ansi"
|
4
|
+
|
5
|
+
module Strings
|
6
|
+
module ANSI
|
7
|
+
module Extensions
|
8
|
+
refine String do
|
9
|
+
def ansi?
|
10
|
+
ANSI.ansi?(self)
|
11
|
+
end
|
12
|
+
|
13
|
+
def only_ansi?
|
14
|
+
ANSI.only_ansi?(self)
|
15
|
+
end
|
16
|
+
|
17
|
+
def sanitize
|
18
|
+
ANSI.sanitize(self)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end # Extensions
|
22
|
+
end # ANSI
|
23
|
+
end # Strings
|
@@ -0,0 +1,194 @@
|
|
1
|
+
---
|
2
|
+
[
|
3
|
+
"\eA", # Cursor up
|
4
|
+
"\eB", # Cursor down
|
5
|
+
"\eC", # Cursor right
|
6
|
+
"\eD", # Cursor left
|
7
|
+
"\eF", # Special graphics character set
|
8
|
+
"\eG", # Select ASCII character set
|
9
|
+
"\eH", # Cursor to home
|
10
|
+
"\eI", # Reverse line feed
|
11
|
+
"\eJ", # Erase to end of screen
|
12
|
+
"\eK", # Erase to end of line
|
13
|
+
"\eZ", # Identify what the terminal is
|
14
|
+
"\e=", # Enter alternate keypad mode
|
15
|
+
"\e>", # Exit alternate keypad mode
|
16
|
+
"\e1", # Graphics processor on
|
17
|
+
"\e2", # Graphics processor off
|
18
|
+
"\e<", # Enter ANSI mode
|
19
|
+
# Movement
|
20
|
+
"\e[12A", # Cursor up 12 lines
|
21
|
+
"\e[12B", # Cursor down 12 lines
|
22
|
+
"\e[12C", # Cursor forward 12 characters (right)
|
23
|
+
"\e[12D", # Cursor backward 12 characters (left)
|
24
|
+
"\e[11;22H", # Direct cursor addressing, where 11 is line, 22 is column
|
25
|
+
"\e[11;22f", # Direct cursor addressing, where 11 is line, 22 is column
|
26
|
+
"\e F", # Send as 7-bit controls
|
27
|
+
"\e F", # Send as 7-bit controls
|
28
|
+
"\e L", # Set ANSI conformance level 1
|
29
|
+
"\e M", # Set ANSI conformance level 2
|
30
|
+
"\e N", # Set ANSI conformance level 3
|
31
|
+
"\eD", # Index
|
32
|
+
"\eM", # Reverse index
|
33
|
+
"\e6", # Back Index, VT420 and up.
|
34
|
+
"\e7", # Save cursor and attributes
|
35
|
+
"\e8", # Restore cursor and attributes
|
36
|
+
"\e9", # Forward Index, VT420 and up.
|
37
|
+
"\e#3", # Change this line to double-height top half
|
38
|
+
"\e#4", # Change this line to double-height bottom half
|
39
|
+
"\e#5", # Change this line to single-width single-height
|
40
|
+
"\e#6", # Change this line to double-width single-height
|
41
|
+
"\e[s", # Save current cursor position
|
42
|
+
"\e[u", # Restores cursor position
|
43
|
+
"\e[1 u", # Set margin-bell to be off
|
44
|
+
"\e[4 u", # Set margin-bell to low volume
|
45
|
+
"\e[8 u", # Set margin-bell to high volume
|
46
|
+
"\e[1;32;101m", # Set display attributes
|
47
|
+
"\e[0m", # All attributes off
|
48
|
+
"\e[1m", # Bold on
|
49
|
+
"\e[2m", # Turn low intensity mode on
|
50
|
+
"\e[4m", # Turn underline mode on
|
51
|
+
"\e[5m", # Turn blinking mode on
|
52
|
+
"\e[7m", # Turn reverse video on
|
53
|
+
"\e[8m", # Turn invisible text mode on
|
54
|
+
# Clearing
|
55
|
+
"\e[K", # Erase from cursor to end of line
|
56
|
+
"\e[0K", # Erase from cursor to end of line
|
57
|
+
"\e[?0K", # Erase from cursor to end of line, VT220
|
58
|
+
"\e[1K", # Erase from beginning of line to cursor
|
59
|
+
"\e[2K", # Erase line containing cursor
|
60
|
+
"\e[J", # Erase from cursor to end of screen
|
61
|
+
"\e[0J", # Erase from cursor to end of screen
|
62
|
+
"\e[2J", # Erase entire screen
|
63
|
+
"\e[1;2;3q", # Load programmable LEDs
|
64
|
+
# # Character sets
|
65
|
+
"\en", # Invoke the G2 Character Set as GL
|
66
|
+
"\eo", # Invoke the G3 Character Set as GL
|
67
|
+
"\e~", # Invoke the G1 Character Set
|
68
|
+
"\e}", # Invoke the G2 Character Set
|
69
|
+
"\e|", # Invoke the G3 Character Set
|
70
|
+
"\e%@", # Select default character set
|
71
|
+
"\e%G", # Select UTF-8 character set
|
72
|
+
"\e(A", # Set United Kingdom G0 character set
|
73
|
+
"\e(B", # Set United States G0 character set
|
74
|
+
"\e(C", # Set Finnish G0 character set
|
75
|
+
"\e(E", # Set Norwegian/Danish G0 character set
|
76
|
+
"\e(H", # Set Swedish G0 character set
|
77
|
+
"\e(K", # Set German G0 character set
|
78
|
+
"\e(Q", # Set French Canadian G0 character set
|
79
|
+
"\e(f", # Set French G0 character set
|
80
|
+
"\e(%", # Set Hebrew G0 character set
|
81
|
+
"\e(=", # Set Swiss G0 character set
|
82
|
+
"\e(0", # Set G0 special chars. & line set
|
83
|
+
"\e(1", # Set G0 alternate character ROM
|
84
|
+
"\e(2", # Set G0 alt char ROM and spec. graphics
|
85
|
+
"\e)A", # Set United Kingdom G1 character set
|
86
|
+
"\e)B", # Set United States G1 character set
|
87
|
+
"\e)C", # Set Finnish G1 character set
|
88
|
+
"\e)E", # Set Norwegian/Danish G1 character set
|
89
|
+
"\e)H", # Set Swedish G1 character set
|
90
|
+
"\e)K", # Set German G1 character set
|
91
|
+
"\e)Q", # Set French Canadian G1 character set
|
92
|
+
"\e)f", # Set French G1 character set
|
93
|
+
"\e)%", # Set Hebrew G1 character set
|
94
|
+
"\e)=", # Set Swiss G1 character set
|
95
|
+
"\e)0", # Set G1 special chars. & line set
|
96
|
+
"\e)1", # Set G1 alternate character ROM
|
97
|
+
"\e)2", # Set G1 alt char ROM and spec. graphics
|
98
|
+
"\e*A", # Set United Kingdom G2 character set
|
99
|
+
"\e+A", # Set United Kingdom G3 character set
|
100
|
+
"\e-A", # Set United Kingdom G1 character set
|
101
|
+
"\e.A", # Set United Kingdom G2 character set
|
102
|
+
"\e/A", # Set United Kingdom G3 character set
|
103
|
+
"\eN", # Set single shift 2
|
104
|
+
"\eH", # Set tab at current column
|
105
|
+
"\e[g", # Clear tab at current column
|
106
|
+
"\e[0g", # Clear a tab at the current column
|
107
|
+
"\e[3g", # Clear all tabs
|
108
|
+
# Modes
|
109
|
+
"\e[20h", # New line
|
110
|
+
"\e[?1h", # Cursor key Application
|
111
|
+
"\e[?3h", # Column mode 132 col
|
112
|
+
"\e[?4h", # Scrolling Smooth
|
113
|
+
"\e[?5h", # Screen mode Reverse
|
114
|
+
"\e[?6h", # Origin mode Relative
|
115
|
+
"\e[?7h", # Wraparound On
|
116
|
+
"\e[?8h", # Autorepeat On
|
117
|
+
"\e[?9h", # Interface On
|
118
|
+
"\e[20l", # Line feed
|
119
|
+
"\e[?1l", # Cursor key Cursor
|
120
|
+
"\e[?2l", # VT52
|
121
|
+
"\e[?3l", # Column mode 80 col
|
122
|
+
"\e[?4l", # Scrolling Jump
|
123
|
+
"\e[?5l", # Screen mode Normal
|
124
|
+
"\e[?6l", # Origin mode Absolute
|
125
|
+
"\e[?7l", # Wraparound Off
|
126
|
+
"\e[?8l", # Autorepeat Off
|
127
|
+
"\e[?9l", # Interface Off
|
128
|
+
"\e[?25h", # Make cursor visible
|
129
|
+
"\e[?25l", # Make cursor invisible
|
130
|
+
# Reports
|
131
|
+
"\e[6n", # Cursor position report
|
132
|
+
"\e[1;2R", # (response; 1=line; 2=column)
|
133
|
+
"\e[5n", # Status report
|
134
|
+
"\e[>0n", # Disable keyboard key modifiers
|
135
|
+
"\e[>1n", # Disable cursor key modifiers
|
136
|
+
"\e[>2n", # Disable function key modifiers
|
137
|
+
"\e[c", # (response; terminal Ok)
|
138
|
+
"\e[0c", # (response; teminal not Ok)
|
139
|
+
"\e[?1;2c", # response; where Ps is option present:]
|
140
|
+
"\ec", # Causes power-up reset routine to be executed
|
141
|
+
"\e#8", # Fill screen with "E"
|
142
|
+
"\e[2;1y", # Confidence power up test
|
143
|
+
"\e[2;2y", # Confidence loopback test
|
144
|
+
"\e[2;9y", # Repeat power up test
|
145
|
+
"\e[2;10y", # Repeat loopback test
|
146
|
+
"\e[!p", # Soft terminal reset, VT220 and up.
|
147
|
+
"\e[>0p", # Set to never hide the pointer
|
148
|
+
"\e[>1p", # Set to hide if the mouse tracking mode is not enabled
|
149
|
+
"\e[>2p", # Set to always hide the pointer, except when leaving the window
|
150
|
+
"\e[>3p", # Set to always hide the pointer
|
151
|
+
# Key editing
|
152
|
+
"\e[1~", # Home
|
153
|
+
"\e[2~", # Insert
|
154
|
+
"\e[3~", # Delete
|
155
|
+
"\e[4~", # End
|
156
|
+
"\e[5~", # PageUp
|
157
|
+
"\e[6~", # PageDown
|
158
|
+
# Special keys
|
159
|
+
"\eOP", # F1
|
160
|
+
"\eOQ", # F2
|
161
|
+
"\eOR", # F3
|
162
|
+
"\eOS", # F4
|
163
|
+
"\eOp", # Keypad 0
|
164
|
+
"\eOq", # Keypad 1
|
165
|
+
"\eOr", # Keypad 2
|
166
|
+
"\eOs", # Keypad 3
|
167
|
+
"\eOt", # Keypad 4
|
168
|
+
"\eOA", # Up arrow
|
169
|
+
"\eOB", # Down arrow
|
170
|
+
"\eOC", # Right arrow
|
171
|
+
"\eOD", # Left arrow
|
172
|
+
# Special keys URXVT
|
173
|
+
"\e[21~", # F0
|
174
|
+
"\e[11~", # F1
|
175
|
+
"\e[12~", # F2
|
176
|
+
"\e[13~", # F3
|
177
|
+
"\e[23$", # F21
|
178
|
+
"\e[11^", # F23
|
179
|
+
"\e[23@", # F43
|
180
|
+
# Special keys SGI consoles
|
181
|
+
"\e[@", # F41
|
182
|
+
"\e[\\", # F43
|
183
|
+
"\e[]", # F44
|
184
|
+
"\e[_", # F46
|
185
|
+
"\e[{", # F48
|
186
|
+
# Special keys XTerm
|
187
|
+
"\e[[A", # F1
|
188
|
+
"\e[[B", # F2
|
189
|
+
"\e[[C", # F3
|
190
|
+
"\e[[D", # F4
|
191
|
+
"\e[[E", # F5
|
192
|
+
"\e[15;2~", # F17
|
193
|
+
"\e[17;2~" # F18
|
194
|
+
]
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
if ENV["COVERAGE"] == "true"
|
4
|
+
require "simplecov"
|
5
|
+
require "coveralls"
|
6
|
+
|
7
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
|
8
|
+
SimpleCov::Formatter::HTMLFormatter,
|
9
|
+
Coveralls::SimpleCov::Formatter
|
10
|
+
])
|
11
|
+
|
12
|
+
SimpleCov.start do
|
13
|
+
command_name "spec"
|
14
|
+
add_filter "spec"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
require "bundler/setup"
|
19
|
+
require "strings-ansi"
|
20
|
+
require "yaml"
|
21
|
+
|
22
|
+
module TestHelpers
|
23
|
+
module Paths
|
24
|
+
def gem_root
|
25
|
+
::File.dirname(__dir__)
|
26
|
+
end
|
27
|
+
|
28
|
+
def dir_path(*args)
|
29
|
+
path = ::File.join(gem_root, *args)
|
30
|
+
FileUtils.mkdir_p(path) unless ::File.exist?(path)
|
31
|
+
::File.realpath(path)
|
32
|
+
end
|
33
|
+
|
34
|
+
def fixtures_path(*args)
|
35
|
+
::File.expand_path(::File.join(dir_path("spec/fixtures"), *args))
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
RSpec.configure do |config|
|
41
|
+
config.extend(TestHelpers::Paths)
|
42
|
+
# Enable flags like --only-failures and --next-failure
|
43
|
+
config.example_status_persistence_file_path = ".rspec_status"
|
44
|
+
|
45
|
+
# Disable RSpec exposing methods globally on `Module` and `main`
|
46
|
+
config.disable_monkey_patching!
|
47
|
+
|
48
|
+
config.expect_with :rspec do |c|
|
49
|
+
c.syntax = :expect
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.describe Strings::ANSI, "#ansi?" do
|
4
|
+
it "does't report empty string" do
|
5
|
+
expect(Strings::ANSI.ansi?("")).to eq(false)
|
6
|
+
end
|
7
|
+
|
8
|
+
it "reports non-ansi string correctly" do
|
9
|
+
expect(Strings::ANSI.ansi?("foo")).to eq(false)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "checks if code is ansi" do
|
13
|
+
expect(Strings::ANSI.ansi?("\e[33;44mfoo\e[0m")).to eq(true)
|
14
|
+
end
|
15
|
+
end
|