synvert 0.12.0 → 0.12.1

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: e1c67ec2f25a9e357beea399dbdf83f6d4a46a2e3a3729843e2cca128a662b73
4
- data.tar.gz: 4327ecc60f5d4681c2f03bd6e63c2e854a3f9f278c363a71ef9a48126d82320b
3
+ metadata.gz: 6850587d42a82286479a86f22018a83b4e6f3b6d23d65a6518120acde4c4a52c
4
+ data.tar.gz: e9a223cae6a39601d7bd9f793c109d28db4483664da77a20a88c267a4432568e
5
5
  SHA512:
6
- metadata.gz: ce66beb043128746d3771c38a13887e5bd560246c925c5a1570180878b6b86694a4c83074cb5982adfc21f9a930b13b63434d551050270f92f27e485c3500ac5
7
- data.tar.gz: 0550f8223f2f21f4639e5c63dc475767a281c710b06291c69783f68a22441cfb0d8f92f068c22d24d436521cab40c5bcc90d9836b951b3e0e27835be45443561
6
+ metadata.gz: eca37ac2eda8ea96d555b32061336b2576f0efbd5471dbfb0ca58594e21a55e17559675d8f2880d5b0f9740564f719311eb06bb34f90491bed713c0b7d6e3267
7
+ data.tar.gz: 796ce440e914222563a41741b54a89584da3ee2418fe830a37bdfa076beabb794c69312d38e3a319f42c2d483dd72ccb402666dd97e0b0aa539ef47726b0c2b9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.12.1 (2021-03-01)
4
+
5
+ * Display snippet source code for showing a snippet
6
+
3
7
  ## 0.12.0 (2021-03-01)
4
8
 
5
9
  * Display `synvert-core` and `parser` version
data/lib/synvert/cli.rb CHANGED
@@ -114,9 +114,7 @@ module Synvert
114
114
  'run specified snippets, each SNIPPET_NAME is combined by group and name, e.g. ruby/new_hash_syntax,ruby/new_lambda_syntax' do |snippet_names|
115
115
  @options[:snippet_names] = snippet_names.split(',').map(&:strip)
116
116
  end
117
- opts.on '-g',
118
- '--generate NEW_SNIPPET_NAME',
119
- 'generate a new snippet' do |name|
117
+ opts.on '-g', '--generate NEW_SNIPPET_NAME', 'generate a new snippet' do |name|
120
118
  @options[:command] = 'generate'
121
119
  @options[:snippet_name] = name
122
120
  end
@@ -224,18 +222,9 @@ module Synvert
224
222
 
225
223
  # Show and print one rewriter.
226
224
  def show_rewriter
227
- group, name = @options[:snippet_name].split('/')
228
- rewriter = Core::Rewriter.fetch(group, name)
229
- if rewriter
230
- rewriter.process_with_sandbox
231
- puts rewriter.description
232
- rewriter.sub_snippets.each do |sub_rewriter|
233
- puts
234
- puts '=' * 80
235
- puts "snippet: #{sub_rewriter.name}"
236
- puts '=' * 80
237
- puts sub_rewriter.description
238
- end
225
+ path = File.expand_path(File.join(default_snippets_path, "lib/#{@options[:snippet_name]}.rb"))
226
+ if File.exist?(path)
227
+ puts File.read(path)
239
228
  else
240
229
  puts "snippet #{@options[:snippet_name]} not found"
241
230
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Synvert
4
- VERSION = '0.12.0'
4
+ VERSION = '0.12.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synvert
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang