gemoji-cli 1.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 259ef6cb27019361b5ba2fde8894af3e7989091af84c38c0ca5294f621610b72
4
+ data.tar.gz: 7c908ec314daf7646c0b9d18f31149093d13aa0751b0e1470c3a2dbad7ed6851
5
+ SHA512:
6
+ metadata.gz: 6d23ac895a205c2b768fd427e4b1a426cfd9158d5db64f266a57b9a5ef5223096431ff40876f49a72182bb7ff3e746c39b31bc125471e5414415d2fc53b9a9d9
7
+ data.tar.gz: dcbaff573657f536b63050c3ed4cb7eb3029e9ebf0182f0a59622fc5c2f3019a85a80c448be47449a9f2eca156dc9dfa6468d9c9d7bcdb0eb0594e22868f7a71
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,47 @@
1
+ ---
2
+ AllCops:
3
+ DisplayCopNames: true
4
+ DisplayStyleGuide: true
5
+ EnabledByDefault: true
6
+ Exclude:
7
+ - bin/**/*
8
+ - vendor/**/*
9
+ ExtraDetails: true
10
+ TargetRubyVersion: 3.4
11
+ UseCache: true
12
+ inherit_mode:
13
+ merge:
14
+ - Exclude
15
+ plugins:
16
+ - rubocop-performance
17
+ - rubocop-rake
18
+ - rubocop-rspec
19
+ - rubocop-thread_safety
20
+ require: []
21
+ inherit_from:
22
+ - .rubocop_todo.yml
23
+ - .rubocop/bundler.yml
24
+ - .rubocop/gemspec.yml
25
+ - .rubocop/layout.yml
26
+ - .rubocop/lint.yml
27
+ - .rubocop/metrics.yml
28
+ - .rubocop/migration.yml
29
+ - .rubocop/naming.yml
30
+ - .rubocop/performance.yml
31
+ - .rubocop/rspec.yml
32
+ - .rubocop/rake.yml
33
+ - .rubocop/security.yml
34
+ - .rubocop/style.yml
35
+ - .rubocop/threadsafety.yml
36
+
37
+
38
+ Style/DisableCopsWithinSourceCodeDirective:
39
+ AllowedCops:
40
+ - Style/MissingElse
41
+
42
+ Style/DocumentationMethod:
43
+ inherit_mode:
44
+ merge:
45
+ - AllowedMethods
46
+ AllowedMethods:
47
+ - call
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,7 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config --no-exclude-limit --no-offense-counts --no-auto-gen-timestamp`
3
+ # using RuboCop version 1.72.2.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
data/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
1
+ ## [Unreleased]
2
+
3
+ ## [1.0.0] - 2025-02-24
4
+ - Initial release
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 OZAWA Sakuro
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Gemoji::Cli
2
+
3
+ TODO: Delete this and the text below, and describe your gem
4
+
5
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/gemoji/cli`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+
7
+ ## Installation
8
+
9
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
+
11
+ Install the gem and add to the application's Gemfile by executing:
12
+
13
+ ```bash
14
+ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
15
+ ```
16
+
17
+ If bundler is not being used to manage dependencies, install the gem by executing:
18
+
19
+ ```bash
20
+ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/gemoji-cli.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+ Dir["lib/tasks/*.rake"].each { load it }
8
+
9
+ task default: %i[spec rubocop]
data/exe/gemoji ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "gemoji/cli"
5
+
6
+ Dry::CLI.new(Gemoji::CLI::Commands).call
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gemoji
4
+ module CLI
5
+ module Commands
6
+ # Filter command
7
+ class Filter < Dry::CLI::Command
8
+ desc "Read standard input and convert emoji notations to corresponding Unicode sequences"
9
+
10
+ def call(*, **)
11
+ filter($stdin)
12
+ end
13
+
14
+ private def filter(io)
15
+ io.each_line.map do |line|
16
+ line.gsub!(/:([\w+-]+):/) do |match|
17
+ emoji = Emoji.find_by_alias($1)
18
+ emoji && !emoji.custom? ? emoji.raw : match
19
+ end
20
+ print line
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "csv"
4
+ require "gemoji"
5
+
6
+ module Gemoji
7
+ module CLI
8
+ module Commands
9
+ # List command
10
+ class List < Dry::CLI::Command
11
+ desc "List all recognized emoji"
12
+
13
+ option :format, default: "markdown", values: %w[markdown csv], desc: "Output format"
14
+
15
+ HEADINGS = %w[Name Raw].freeze
16
+ private_constant :HEADINGS
17
+
18
+ def call(**options)
19
+ case options[:format] # rubocop:disable Style/MissingElse
20
+ when "markdown"
21
+ list_markdown
22
+ when "csv"
23
+ list_csv
24
+ end
25
+ end
26
+
27
+ private def list_markdown
28
+ puts "| #{HEADINGS.join(" | ")} |"
29
+ puts "|------|-----|"
30
+ Emoji.all.each do |emoji|
31
+ puts "| :#{emoji.name}: | #{emoji.raw} |"
32
+ end
33
+ end
34
+
35
+ private def list_csv
36
+ csv = CSV.generate {|out|
37
+ out << HEADINGS
38
+ Emoji.all.each do |emoji|
39
+ out << [":#{emoji.name}:", emoji.raw]
40
+ end
41
+ }
42
+ puts csv
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gemoji
4
+ module CLI
5
+ module Commands
6
+ # Version command
7
+ class Version < Dry::CLI::Command
8
+ desc "Print the version"
9
+
10
+ def call(*, **)
11
+ puts "#{File.basename($PROGRAM_NAME)} #{Gemoji::CLI::VERSION}"
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gemoji
4
+ module CLI
5
+ VERSION = "1.0.0"
6
+ public_constant :VERSION
7
+ end
8
+ end
data/lib/gemoji/cli.rb ADDED
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "dry/cli"
4
+ require_relative "cli/commands/filter"
5
+ require_relative "cli/commands/list"
6
+ require_relative "cli/commands/version"
7
+ require_relative "cli/version"
8
+
9
+ module Gemoji
10
+ module CLI
11
+ # The command registry for the CLI
12
+ module Commands
13
+ extend Dry::CLI::Registry
14
+
15
+ register "filter", Gemoji::CLI::Commands::Filter
16
+ register "list", Gemoji::CLI::Commands::List, aliases: ["ls"]
17
+ register "version", Gemoji::CLI::Commands::Version, aliases: ["v", "-v", "--version"]
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rubocop/rake_task"
4
+
5
+ RuboCop::RakeTask.prepend(Module.new do
6
+ # Additionally define rubocop:regenerate_todo task.
7
+ def setup_subtasks(name, *, &task_block)
8
+ super
9
+ namespace name do
10
+ desc "Regenerate RuboCop TODO file"
11
+ task(:regenerate_todo, *) do |_, task_args|
12
+ RakeFileUtils.verbose(verbose) do
13
+ yield(*[self, task_args].slice(0, task_block.arity)) if task_block
14
+ perform("--regenerate-todo")
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end)
20
+
21
+ RuboCop::RakeTask.new
data/mise.toml ADDED
@@ -0,0 +1,2 @@
1
+ [env]
2
+ _.path = ["bin", "exe"]
@@ -0,0 +1,6 @@
1
+ module Gemoji
2
+ module Cli
3
+ VERSION: String
4
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gemoji-cli
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - OZAWA Sakuro
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 2025-02-24 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: csv
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: 3.3.2
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: 3.3.2
26
+ - !ruby/object:Gem::Dependency
27
+ name: dry-cli
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.2.0
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: 1.2.0
40
+ - !ruby/object:Gem::Dependency
41
+ name: gemoji
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 4.1.0
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 4.1.0
54
+ description: |
55
+ A command-line tool that:
56
+ - Converts GitHub emoji codes to Unicode.
57
+ - Lists supported emojis in Markdown or CSV format.
58
+ email:
59
+ - 10973+sakuro@users.noreply.github.com
60
+ executables:
61
+ - gemoji
62
+ extensions: []
63
+ extra_rdoc_files: []
64
+ files:
65
+ - ".rspec"
66
+ - ".rubocop.yml"
67
+ - ".rubocop_todo.yml"
68
+ - CHANGELOG.md
69
+ - LICENSE.txt
70
+ - README.md
71
+ - Rakefile
72
+ - exe/gemoji
73
+ - lib/gemoji/cli.rb
74
+ - lib/gemoji/cli/commands/filter.rb
75
+ - lib/gemoji/cli/commands/list.rb
76
+ - lib/gemoji/cli/commands/version.rb
77
+ - lib/gemoji/cli/version.rb
78
+ - lib/tasks/rubocop.rake
79
+ - mise.toml
80
+ - sig/gemoji/cli.rbs
81
+ homepage: https://github.com/sakuro/gemoji-cli
82
+ licenses:
83
+ - MIT
84
+ metadata:
85
+ homepage_uri: https://github.com/sakuro/gemoji-cli
86
+ source_code_uri: https://github.com/sakuro/gemoji-cli.git
87
+ changelog_uri: https://github.com/sakuro/gemoji-cli/blob/main/CHANGELOG.md
88
+ rubygems_mfa_required: 'true'
89
+ rdoc_options: []
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: 3.4.2
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ requirements: []
103
+ rubygems_version: 3.6.5
104
+ specification_version: 4
105
+ summary: GitHub emoji converter and lister
106
+ test_files: []