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.
- checksums.yaml +4 -4
- data/exe/ruslat +53 -0
- data/lib/ruslat/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c306235bbffc758b3e67e417be3925864403240266615eed7e8869864d87bf6
|
4
|
+
data.tar.gz: cac8dccb9dade2c74c076b8e5b65c905084582856dde1ecd1ad535133930d124
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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?
|
data/lib/ruslat/version.rb
CHANGED
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.
|
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:
|
11
|
+
date: 2023-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|