ruslat 1.0.2 → 1.0.3

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/exe/ruslat +53 -0
  3. data/lib/ruslat/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46ca5117941805802bf94d4a0f0e7e8459454789278a96546700c823a4acfaf0
4
- data.tar.gz: e7985451efafda2d56caaa5d7216bee219b8e6c283673d4ea690daf53879c904
3
+ metadata.gz: 7c306235bbffc758b3e67e417be3925864403240266615eed7e8869864d87bf6
4
+ data.tar.gz: cac8dccb9dade2c74c076b8e5b65c905084582856dde1ecd1ad535133930d124
5
5
  SHA512:
6
- metadata.gz: b9cafb1939bfbe16b4d67b151006fe3b4a629d0b1533aaf0ecfe399e5658ae006458037cf429c319206a0e9c11ed6b3bd499160156497733d71f1c2d3895e14d
7
- data.tar.gz: 44c72cbe478e52265b44e934e6183aee9cf09f55516adbf0b08332528a7d9d33b6a6e2986cd7f749f7f71a014229bc94f824b590d9e52e45c20531a3e4550e86
6
+ metadata.gz: 13e1b496a408991d26a6c25b06608af34c2a2c3b40c2504cbaea2b64e2dbba4560c7738bc4001f80ef317b4a8bfab8f710ef414ee91f0fd92749c7251bdc4fd2
7
+ data.tar.gz: 1f5c451a411c3216f2e26268ad1284b23da2c5ad9a377922b70343e66068956438c199e5bc45580779ea80f9b92a19ce935e20fc24f537e040f4cc9660e50678
data/exe/ruslat CHANGED
@@ -1,3 +1,56 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "ruslat"
4
+ require "optparse"
5
+
6
+ options = {
7
+ convert: :rus_lat,
8
+ "typo-correct": true,
9
+ "case-correct": true
10
+ }
11
+
12
+ OptionParser.new do |parser|
13
+ parser.banner = "Usage: ruslat [options] [path]"
14
+
15
+ parser.on("-R", "Convert RUS => LAT (default)") { options[:convert] = :rus_lat }
16
+ parser.on("-L", "Convert LAT => RUS") { options[:convert] = :lat_rus }
17
+
18
+ parser.on("-t", "--text=TEXT", String, "Text to convert")
19
+ # parser.on("-f", "--[no-]filename", "Convert file names")
20
+ # parser.on("-d", "--[no-]dirname", "Convert directory names")
21
+ # parser.on("-r", "--[no-]recursive", "Convert file/directory names recursive")
22
+
23
+ parser.on("-T", "--[no-]typo-correct", "Typo correct (default: true)")
24
+ parser.on("-C", "--[no-]case-correct", "Case correct (default: true)")
25
+
26
+ parser.on("-v", "--[no-]verbose", "Run verbosely")
27
+
28
+ parser.on("-h", "--help", "Prints this page") do
29
+ puts parser
30
+ exit
31
+ end
32
+ end.parse!(into: options)
33
+
34
+ text = if options.key?(:text)
35
+ options[:text].to_s
36
+ elsif ARGV[0] && File.exist?(ARGV[0])
37
+ File.read(ARGV[0])
38
+ elsif !$stdin.tty?
39
+ $stdin.read
40
+ else
41
+ ARGV.join(" ")
42
+ end
43
+
44
+ text.chomp!
45
+
46
+ if options[:convert] == :rus_lat
47
+ text = Ruslat.rus_typo_correct(text) if options[:"typo-correct"]
48
+ text = Ruslat.rus_to_lat(text)
49
+ text = Ruslat.lat_case_correct(text) if options[:"case-correct"]
50
+ elsif options[:convert] == :lat_rus
51
+ text = Ruslat.lat_typo_correct(text) if options[:"typo-correct"]
52
+ text = Ruslat.lat_to_rus(text)
53
+ end
54
+
55
+ $stdout << text
56
+ $stdout << "\n" unless text.empty?
@@ -1,3 +1,3 @@
1
1
  module Ruslat
2
- VERSION = "1.0.2".freeze
2
+ VERSION = "1.0.3".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruslat
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vasiliy Sukhachev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-25 00:00:00.000000000 Z
11
+ date: 2023-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler