tty-color-cli 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d5793488c8568cf4ac5da13dfa174744860dc392
4
- data.tar.gz: b57ac42036f2232514dbbee8830aa4e866b6d7f4
2
+ SHA256:
3
+ metadata.gz: b2420e960c6be6d7e080838a50972135dfe1468bd4e6d6ec6b097054a0665404
4
+ data.tar.gz: 669933eeb29b299ec61b79b18651414ac5419e747098db798c3cf342d81d26f5
5
5
  SHA512:
6
- metadata.gz: 6b6476abd4ba6b8f339cce8c04c9a59a659e040ba132054782a6992d6b34692d992b51f5fb9bb9e6d2e231417dab945eea20a71d245322ee2214e4116ea74672
7
- data.tar.gz: 877f253e0afd687d63aacdf2f3decb1ce566e98fda4c3335f62d43e051f83b128607806239cfd29f82a83d262d3dae0287c93bf1575f163c53a5eed5e5866e0c
6
+ metadata.gz: e16424a8637fefc4e267896b4eaac28c23f01fea549dc14bd133b4faec8bc54fbc467747ac3ad05c33cad0f81b0bddcf9876ac0766a0cb40da7957f2a7ec896f
7
+ data.tar.gz: 3c2012c5b11ff8b69804108165f1166d4422fbeff9f9b3cdb830585a14be051cbe7da61cdae8edc8f33f1619adc0c77b8182be809b3c7539668560ac5c98aa4c
@@ -1,7 +1,28 @@
1
1
  # Change log
2
2
 
3
+ ## [v0.3.0] - 2020-08-09
4
+
5
+ ### Add
6
+ * Add tty-color.1 manual page
7
+
8
+ ### Changed
9
+ * Change executable name from color to tty-color
10
+ * Change executable to stop raising error and exit with a message
11
+ * Change --verbose to --debug option
12
+ * Change gemspec to remove test files, load executable directly
13
+ * Change gemspec to require Ruby 2.0 or higher
14
+ * Change to update tty-color dependency
15
+ * Change executable to print newline
16
+
17
+ ## [v0.2.0] - 2016-12-27
18
+
19
+ ### Changed
20
+ * Change to update tty-color dependency
21
+
3
22
  ## [v0.1.0] - 2016-03-05
4
23
 
5
24
  Initial release
6
25
 
7
- [v0.1.0]: https://github.com/peter-murach/tty-color-cli/compare/v0.1.0
26
+ [v0.3.0]: https://github.com/piotrmurach/tty-color-cli/compare/v0.2.0...v0.3.0
27
+ [v0.2.0]: https://github.com/piotrmurach/tty-color-cli/compare/v0.1.0...v0.2.0
28
+ [v0.1.0]: https://github.com/piotrmurach/tty-color-cli/compare/v0.1.0
data/README.md CHANGED
@@ -3,15 +3,11 @@
3
3
  [![Gem Version](https://badge.fury.io/rb/tty-color-cli.svg)][gem]
4
4
  [![Build Status](https://secure.travis-ci.org/piotrmurach/tty-color-cli.svg?branch=master)][travis]
5
5
  [![Build status](https://ci.appveyor.com/api/projects/status/tr24h4edq3xqafkn?svg=true)][appveyor]
6
- [![Code Climate](https://codeclimate.com/github/piotrmurach/tty-color-cli/badges/gpa.svg)][codeclimate]
7
- [![Coverage Status](https://coveralls.io/repos/github/piotrmurach/tty-color-cli/badge.svg)][coverage]
8
6
 
9
7
  [gitter]: https://gitter.im/piotrmurach/tty
10
8
  [gem]: http://badge.fury.io/rb/tty-color-cli
11
9
  [travis]: http://travis-ci.org/piotrmurach/tty-color-cli
12
10
  [appveyor]: https://ci.appveyor.com/project/piotrmurach/tty-color-cli
13
- [codeclimate]: https://codeclimate.com/github/piotrmurach/tty-color-cli
14
- [coverage]: https://coveralls.io/github/piotrmurach/tty-color-cli
15
11
 
16
12
  > CLI tool for terminal color capabilities detection
17
13
 
@@ -22,7 +18,7 @@
22
18
  Add this line to your application's Gemfile:
23
19
 
24
20
  ```ruby
25
- gem 'tty-color-cli'
21
+ gem "tty-color-cli"
26
22
  ```
27
23
 
28
24
  And then execute:
@@ -35,25 +31,25 @@ Or install it yourself as:
35
31
 
36
32
  ## Usage
37
33
 
38
- Running `color` with `-h` or `--help` flats will display help information:
34
+ Running `tty-color` with `-h` or `--help` flags will display help information:
39
35
 
40
36
  ```bash
41
- $ color --help
37
+ $ tty-color --help
42
38
  ```
43
39
 
44
- **TTY::Color** comes with a command line tool to detect color support in terminal. The results are redirected to standard output.
40
+ To check for terminal color support run `tty-color` or pass a flag `--support` or `-s` like so:
45
41
 
46
42
  ```bash
47
- color
48
- color -s
49
- color --support
43
+ tty-color
44
+ tty-color -s
45
+ tty-color --support
50
46
  ```
51
47
 
52
- and to check number of colors:
48
+ To check number of supported colors do:
53
49
 
54
50
  ```bash
55
- color -m
56
- color --mode
51
+ tty-color -m
52
+ tty-color --mode
57
53
  ```
58
54
 
59
55
  ## Contributing
@@ -64,6 +60,10 @@ color --mode
64
60
  4. Push to the branch (`git push origin my-new-feature`)
65
61
  5. Create a new Pull Request
66
62
 
63
+ ## Code of Conduct
64
+
65
+ Everyone interacting in the tty-color-cli project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/piotrmurach/tty-color-cli/blob/master/CODE_OF_CONDUCT.md).
66
+
67
67
  ## Copyright
68
68
 
69
- Copyright (c) 2016-2017 Piotr Murach. See LICENSE for further details.
69
+ Copyright (c) 2016 Piotr Murach. See LICENSE for further details.
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ Signal.trap("INT") { exit 1 }
4
+
5
+ require "optparse"
6
+ require "tty-color"
7
+
8
+ options = {}
9
+
10
+ ARGV << "-h" if ARGV.empty?
11
+
12
+ parser = OptionParser.new do |opts|
13
+ opts.on("-m", "--mode", "Check maximum number of supported colors") do
14
+ options[:mode] = true
15
+ end
16
+
17
+ opts.on("-s", "--support", "Check terminal for color support") do
18
+ options[:color] = true
19
+ end
20
+
21
+ options[:verbose] = false
22
+ opts.on("-d", "--debug", "Display debug information" ) do
23
+ options[:verbose] = true
24
+ end
25
+
26
+ opts.on("-h", "--help", "Display help" ) do
27
+ puts opts
28
+ exit
29
+ end
30
+
31
+ opts.on("-v", "--version", "Display the version") do
32
+ puts "0.3.0 (tty-color #{TTY::Color::VERSION})"
33
+ exit
34
+ end
35
+ end
36
+
37
+ begin
38
+ parser.parse!
39
+ rescue OptionParser::ParseError => error
40
+ $stderr.puts error.message
41
+ exit 1
42
+ end
43
+
44
+ TTY::Color.verbose = options[:verbose]
45
+
46
+ puts(options[:mode] ? TTY::Color.mode : TTY::Color.color?)
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ load File.expand_path("../tty-color", __FILE__)
@@ -0,0 +1,35 @@
1
+ .\" generated by kramdown
2
+ .TH "TTY\-COLOR" "1"
3
+ .SH "NAME"
4
+ \fBtty\-color\fP \- query terminal for color support or check number of colors
5
+ .SH "SYNOPSIS"
6
+ \fBtty\-color\fP [options]
7
+ .SH "DESCRIPTION"
8
+ The \fBtty\-color\fP utility queries terminal for color support and checks how many colors can be displayed\.
9
+ .P
10
+ The options are as follows:
11
+ .TP
12
+ \fB\-m\fP, \fB\-\-mode\fP
13
+ Checks number of supported colors
14
+ .TP
15
+ \fB\-s\fP, \fB\-\-support\fP
16
+ Checks terminal for color support
17
+ .TP
18
+ \fB\-d\fP, \fB\-\-debug\fP
19
+ Display debug information
20
+ .SH "EXAMPLES"
21
+ Print if terminal supports colors to the standard output:
22
+ .P
23
+ tty\-color \-s
24
+ .P
25
+ Print the number of colors to the standard output:
26
+ .P
27
+ tty\-color \(emmode
28
+ .SH "EXIT STATUS"
29
+ The \fBtty\-color\fP utility exits 0 on success, and 1 if an error occurs\.
30
+ .SH "SEE ALSO"
31
+ The \fBtty\-color\fP readme https://github\.com/piotrmurach/tty\-color
32
+ .SH "AUTHOR"
33
+ The \fBtty\-color\fP utility is written by Piotr Murach <piotr@piotrmurach\.com>
34
+ .P
35
+ Website: https://ttytoolkit\.org
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tty-color-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Murach
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-27 00:00:00.000000000 Z
11
+ date: 2020-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-color
@@ -16,34 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.4.0
19
+ version: '0.5'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.4.0
26
+ version: '0.5'
27
27
  - !ruby/object:Gem::Dependency
28
- name: bundler
28
+ name: kramdown
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.5.0
34
- - - "<"
35
- - !ruby/object:Gem::Version
36
- version: '2.0'
33
+ version: '1.17'
37
34
  type: :development
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
38
  - - ">="
42
39
  - !ruby/object:Gem::Version
43
- version: 1.5.0
44
- - - "<"
45
- - !ruby/object:Gem::Version
46
- version: '2.0'
40
+ version: '1.17'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: rake
49
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,34 +52,48 @@ dependencies:
58
52
  - - ">="
59
53
  - !ruby/object:Gem::Version
60
54
  version: '0'
61
- description: CLI tool for terminal color capabilities detection
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ description: A command-line tool for terminal color capabilities detection
62
70
  email:
63
- - ''
71
+ - piotr@piotrmurach.com
64
72
  executables:
65
- - color
73
+ - tty-color
74
+ - ttycolor
66
75
  extensions: []
67
- extra_rdoc_files: []
76
+ extra_rdoc_files:
77
+ - README.md
78
+ - CHANGELOG.md
79
+ - LICENSE.txt
68
80
  files:
69
- - ".codeclimate.yml"
70
- - ".gitignore"
71
- - ".rspec"
72
- - ".travis.yml"
73
81
  - CHANGELOG.md
74
- - Gemfile
75
82
  - LICENSE.txt
76
83
  - README.md
77
- - Rakefile
78
- - appveyor.yml
79
- - bin/color
80
- - spec/spec_helper.rb
81
- - spec/unit/color_command_spec.rb
82
- - tasks/coverage.rake
83
- - tasks/spec.rake
84
- - tty-color-cli.gemspec
85
- homepage: http://piotrmurach.github.io/tty/
84
+ - exe/tty-color
85
+ - exe/ttycolor
86
+ - man/tty-color.1
87
+ homepage: https://ttytoolkit.org
86
88
  licenses:
87
89
  - MIT
88
- metadata: {}
90
+ metadata:
91
+ allowed_push_host: https://rubygems.org
92
+ bug_tracker_uri: https://github.com/piotrmurach/tty-color-cli/issues
93
+ changelog_uri: https://github.com/piotrmurach/tty-color-cli/blob/master/CHANGELOG.md
94
+ documentation_uri: https://www.rubydoc.info/gems/tty-color-cli
95
+ homepage_uri: https://ttytoolkit.org
96
+ source_code_uri: https://github.com/piotrmurach/tty-color-cli
89
97
  post_install_message:
90
98
  rdoc_options: []
91
99
  require_paths:
@@ -94,18 +102,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
102
  requirements:
95
103
  - - ">="
96
104
  - !ruby/object:Gem::Version
97
- version: '0'
105
+ version: 2.0.0
98
106
  required_rubygems_version: !ruby/object:Gem::Requirement
99
107
  requirements:
100
108
  - - ">="
101
109
  - !ruby/object:Gem::Version
102
110
  version: '0'
103
111
  requirements: []
104
- rubyforge_project:
105
- rubygems_version: 2.5.1
112
+ rubygems_version: 3.1.2
106
113
  signing_key:
107
114
  specification_version: 4
108
- summary: CLI tool for terminal color capabilities detection
109
- test_files:
110
- - spec/spec_helper.rb
111
- - spec/unit/color_command_spec.rb
115
+ summary: A command-line tool for terminal color capabilities detection
116
+ test_files: []
@@ -1,11 +0,0 @@
1
- ---
2
- engines:
3
- rubocop:
4
- enabled: true
5
- ratings:
6
- paths:
7
- - bin/*
8
- exclude_paths:
9
- - spec/**/*
10
- - examples/**/*
11
- - tasks/**/*
data/.gitignore DELETED
@@ -1,14 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- *.bundle
11
- *.so
12
- *.o
13
- *.a
14
- mkmf.log
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --color
2
- --require spec_helper
3
- --warnings
@@ -1,27 +0,0 @@
1
- ---
2
- language: ruby
3
- sudo: false
4
- cache: bundler
5
- bundler_args: --without yard benchmarks
6
- script: "bundle exec rake ci"
7
- rvm:
8
- - 1.9.3
9
- - 2.0.0
10
- - 2.1.10
11
- - 2.2.5
12
- - 2.3.1
13
- - jruby-9000
14
- - jruby-head
15
- - ruby-head
16
- - rbx-2
17
- matrix:
18
- allow_failures:
19
- - rvm: ruby-head
20
- - rvm: jruby-head
21
- - rvm: jruby-9000
22
- - rvm: rbx-2
23
- fast_finish: true
24
- branches:
25
- only: master
26
- notifications:
27
- email: false
data/Gemfile DELETED
@@ -1,10 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- group :test do
6
- gem 'rspec', '~> 3.5.0'
7
- gem 'simplecov', '~> 0.11.2'
8
- gem 'coveralls', '~> 0.8.2'
9
- gem 'term-ansicolor', '=1.3.2'
10
- end
data/Rakefile DELETED
@@ -1,8 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require "bundler/gem_tasks"
4
-
5
- FileList['tasks/**/*.rake'].each(&method(:import))
6
-
7
- desc 'Run all specs'
8
- task ci: %w[ spec ]
@@ -1,23 +0,0 @@
1
- ---
2
- install:
3
- - SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
4
- - ruby --version
5
- - gem --version
6
- - bundle install
7
- build: off
8
- test_script:
9
- - bundle exec rake ci
10
- environment:
11
- matrix:
12
- - ruby_version: "193"
13
- - ruby_version: "200"
14
- - ruby_version: "200-x64"
15
- - ruby_version: "21"
16
- - ruby_version: "21-x64"
17
- - ruby_version: "22"
18
- - ruby_version: "22-x64"
19
- - ruby_version: "23"
20
- - ruby_version: "23-x64"
21
- matrix:
22
- allow_failures:
23
- - ruby_version: "193"
data/bin/color DELETED
@@ -1,34 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- Signal.trap("INT") { exit 1 }
4
-
5
- require 'optparse'
6
- require 'tty-color'
7
-
8
- options = {}
9
-
10
- parser = OptionParser.new do |opts|
11
- opts.on('-s', '--support', 'Check if terminal supports colors') do
12
- options[:color] = true
13
- end
14
-
15
- opts.on('-m', '--mode', 'Supported colors mode') do
16
- options[:mode] = true
17
- end
18
-
19
- options[:verbose] = false
20
- opts.on('-v', '--verbose', 'Output debug information' ) do
21
- options[:verbose] = true
22
- end
23
-
24
- opts.on('-h', '--help', 'Display help' ) do
25
- puts opts
26
- exit
27
- end
28
- end
29
-
30
- parser.parse!
31
-
32
- TTY::Color.verbose = options[:verbose]
33
-
34
- print(options[:mode] ? TTY::Color.mode : TTY::Color.color?)
@@ -1,45 +0,0 @@
1
- # encoding: utf-8
2
-
3
- $:.unshift File.expand_path("../../bin", __FILE__)
4
-
5
- if RUBY_VERSION > '1.9' and (ENV['COVERAGE'] || ENV['TRAVIS'])
6
- require 'simplecov'
7
- require 'coveralls'
8
-
9
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
10
- SimpleCov::Formatter::HTMLFormatter,
11
- Coveralls::SimpleCov::Formatter
12
- ]
13
-
14
- SimpleCov.start do
15
- command_name 'spec'
16
- add_filter 'spec'
17
- end
18
- end
19
-
20
- RSpec.configure do |config|
21
- config.expect_with :rspec do |expectations|
22
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
23
- end
24
-
25
- config.mock_with :rspec do |mocks|
26
- mocks.verify_partial_doubles = true
27
- end
28
-
29
- # Limits the available syntax to the non-monkey patched syntax that is recommended.
30
- config.disable_monkey_patching!
31
-
32
- # This setting enables warnings. It's recommended, but in some cases may
33
- # be too noisy due to issues in dependencies.
34
- config.warnings = true
35
-
36
- if config.files_to_run.one?
37
- config.default_formatter = 'doc'
38
- end
39
-
40
- config.profile_examples = 2
41
-
42
- config.order = :random
43
-
44
- Kernel.srand config.seed
45
- end
@@ -1,29 +0,0 @@
1
- # encoding: utf-8
2
-
3
- RSpec.describe 'color command' do
4
- it 'runs without arguments' do
5
- expect(`bin/color`).to match(/true/)
6
- expect($?.exitstatus).to eq(0)
7
- end
8
-
9
- it 'shows help' do
10
- expect(`bin/color --help`).to eq([
11
- "Usage: color [options]\n",
12
- " -s, --support Check if terminal supports colors\n",
13
- " -m, --mode Supported colors mode\n",
14
- " -v, --verbose Output debug information\n",
15
- " -h, --help Display help\n"
16
- ].join)
17
- expect($?.exitstatus).to eq(0)
18
- end
19
-
20
- it "detects mode" do
21
- expect(`bin/color --mode`).to match(/(\d+)/)
22
- expect($?.exitstatus).to eq(0)
23
- end
24
-
25
- it "runs in verbose mode" do
26
- expect(`bin/color --verbose --mode`).to match(/(\d+)/)
27
- expect($?.exitstatus).to eq(0)
28
- end
29
- end
@@ -1,11 +0,0 @@
1
- # encoding: utf-8
2
-
3
- desc 'Measure code coverage'
4
- task :coverage do
5
- begin
6
- original, ENV['COVERAGE'] = ENV['COVERAGE'], 'true'
7
- Rake::Task['spec'].invoke
8
- ensure
9
- ENV['COVERAGE'] = original
10
- end
11
- end
@@ -1,29 +0,0 @@
1
- # encoding: utf-8
2
-
3
- begin
4
- require 'rspec/core/rake_task'
5
-
6
- desc 'Run all specs'
7
- RSpec::Core::RakeTask.new(:spec) do |task|
8
- task.pattern = 'spec/{unit,integration}{,/*/**}/*_spec.rb'
9
- end
10
-
11
- namespace :spec do
12
- desc 'Run unit specs'
13
- RSpec::Core::RakeTask.new(:unit) do |task|
14
- task.pattern = 'spec/unit{,/*/**}/*_spec.rb'
15
- end
16
-
17
- desc 'Run integration specs'
18
- RSpec::Core::RakeTask.new(:integration) do |task|
19
- task.pattern = 'spec/integration{,/*/**}/*_spec.rb'
20
- end
21
- end
22
-
23
- rescue LoadError
24
- %w[spec spec:unit spec:integration].each do |name|
25
- task name do
26
- $stderr.puts "In order to run #{name}, do `gem install rspec`"
27
- end
28
- end
29
- end
@@ -1,21 +0,0 @@
1
- # coding: utf-8
2
-
3
- Gem::Specification.new do |spec|
4
- spec.name = 'tty-color-cli'
5
- spec.version = '0.2.0'
6
- spec.authors = ['Piotr Murach']
7
- spec.email = ['']
8
- spec.summary = %q{CLI tool for terminal color capabilities detection}
9
- spec.description = %q{CLI tool for terminal color capabilities detection}
10
- spec.homepage = "http://piotrmurach.github.io/tty/"
11
- spec.license = "MIT"
12
-
13
- spec.files = `git ls-files -z`.split("\x0")
14
- spec.executables = ['color']
15
- spec.test_files = spec.files.grep(%r{^spec/})
16
-
17
- spec.add_dependency 'tty-color', '~> 0.4.0'
18
-
19
- spec.add_development_dependency 'bundler', '>= 1.5.0', '< 2.0'
20
- spec.add_development_dependency 'rake'
21
- end