benry-cmdopt 2.0.0 → 2.0.2

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
2
  SHA256:
3
- metadata.gz: eb91a08288099f5e011818d0dc0790f4a0ce39885417a248365bc1d34342f51b
4
- data.tar.gz: 16ac9a7a312d7fac7ee082b20e18f16dfd0303f685028db29290bebd6e95fdf5
3
+ metadata.gz: 1c4c465878a37b15c65090a251e576059ac389d2a3457379980e8bb353e43a97
4
+ data.tar.gz: e0607fa34db598eb81014b7ed63bebe82985ad20a9a311e7be6b0c6c52f01a88
5
5
  SHA512:
6
- metadata.gz: cd5db670a903764317a3cc0a4a35f96b8c80b3bcc9e422c5d48da7d53a12847017c1175aef861af6abaaa43791e27824557f341d7b4038197fc8bdbfd7285bba
7
- data.tar.gz: bf0c0b66d9c5972662c8bd45db7956fd1cb9a8b8562c3bb1e76fa3ff0421ab42feb8195c76fd04eeb110dd63f06cd787e394090d338b1571be6d9570f3852e28
6
+ metadata.gz: 01cc7b1487d89b9777478064f068c31b847038da6fda2841b9b59c0ee55fc9d62a4d3dac7eae5964c9b25fd0da5e52459c27cbb8eac0412293c0b4de8fb910d9
7
+ data.tar.gz: 934952f9cc686d6014c69034b7aa5810341266b627f5f22719da543baf9f38267cab4214a0aeae8315bb601bc72f96597d976896977c1151fff50c37fe8dce59
data/CHANGES.md CHANGED
@@ -2,6 +2,19 @@ CHANGES
2
2
  =======
3
3
 
4
4
 
5
+ Release 2.0.2 (2023-10-12)
6
+ --------------------------
7
+
8
+ * [change] remove unnecessary files from gem.
9
+ * [bugfix] fix to add missing test cases.
10
+
11
+
12
+ Release 2.0.1 (2023-10-11)
13
+ --------------------------
14
+
15
+ * [bugfix] fix documents.
16
+
17
+
5
18
  Release 2.0.0 (2023-10-10)
6
19
  --------------------------
7
20
 
data/MIT-LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021-2023 kuwata-lab.com
3
+ Copyright (c) 2021 kwatch@gmail.com
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Benry-CmdOpt
2
2
 
3
- ($Release: 2.0.0 $)
3
+ ($Release: 2.0.2 $)
4
4
 
5
5
 
6
6
 
7
- ## Overview
7
+ ## What's This?
8
8
 
9
9
  Benry-CmdOpt is a command option parser library, like `optparse.rb`
10
10
  (Ruby standard library).
@@ -20,11 +20,11 @@ Benry-CmdOpt requires Ruby >= 2.3.
20
20
 
21
21
 
22
22
 
23
- ## Table of Contents
23
+ ### Table of Contents
24
24
 
25
25
  <!-- TOC -->
26
26
 
27
- * [Overview](#overview)
27
+ * [What's This?](#whats-this)
28
28
  * [Why not `optparse.rb`?](#why-not-optparserb)
29
29
  * [Install](#install)
30
30
  * [Usage](#usage)
@@ -236,8 +236,7 @@ opts = {}
236
236
  begin
237
237
  parser.parse!(ARGV, into: opts)
238
238
  rescue OptionParser::ParseError => err # specify error class
239
- $stderr.puts "ERROR: #{err.message}"
240
- exit 1
239
+ abort "ERROR: #{err.message}"
241
240
  end
242
241
 
243
242
  ### benry/cmdopt.rb
@@ -245,21 +244,22 @@ require 'benry/cmdopt'
245
244
  cmdopt = Benry::CmdOpt.new
246
245
  cmdopt.add(:file, '-f, --file=<FILE>', "filename")
247
246
  opts = cmdopt.parse(ARGV) do |err| # error handling wihtout error class name
248
- $stderr.puts "ERROR: #{err.message}"
249
- exit 1
247
+ abort "ERROR: #{err.message}"
250
248
  end
251
249
  ```
252
250
 
253
- * Source code of `optparse.rb` is very large and complicated, because
254
- `OptParse` class does everything about command option parsing.
255
- It is hard to customize or extend `OptionParser` class.
251
+ * The source code of "optparse.rb" is quite large and complex for a command
252
+ option parser library. The reason is that one large `OptParse` class
253
+ does everything related to parsing command options. Bad class design.
254
+ Therefore it is hard to customize or extend `OptionParser` class.
256
255
 
257
256
  In contract, `benry/cmdopt.rb` consists of several classes
258
257
  (schema class, parser class, and facade class).
259
258
  Therefore it is easy to understand and extend these classes.
260
259
 
261
- File `optparse.rb` (in Ruby 3.2) contains 1143 lines (except comments and blanks),
262
- while `benry/cmdopt.rb` (v2.0) contains 427 lines (except both, too).
260
+ In fact, file `optparse.rb` and `optparse/*.rb` (in Ruby 3.2)
261
+ contains total 1298 lines (except comments and blanks), while
262
+ `benry/cmdopt.rb` (v2.0.0) contains only 429 lines (except both, too).
263
263
 
264
264
 
265
265
 
@@ -286,8 +286,7 @@ cmdopt.add(:version, ' --version', "print version")
286
286
 
287
287
  ## parse with error handling
288
288
  options = cmdopt.parse(ARGV) do |err|
289
- $stderr.puts "ERROR: #{err.message}"
290
- exit(1)
289
+ abort "ERROR: #{err.message}"
291
290
  end
292
291
  p options # ex: {:help => true, :version => true}
293
292
  p ARGV # options are removed from ARGV
@@ -642,8 +641,7 @@ schema.add(:indent, '-i, --indent[=<WIDTH>]', "enable indent", type: Integer)
642
641
  parser = Benry::CmdOpt::Parser.new(schema)
643
642
  argv = ['-hi2', '--file=blabla.txt', 'aaa', 'bbb']
644
643
  opts = parser.parse(argv) do |err|
645
- $stderr.puts "ERROR: #{err.message}"
646
- exit 1
644
+ abort "ERROR: #{err.message}"
647
645
  end
648
646
  p opts #=> {:help=>true, :indent=>2, :file=>"blabla.txt"}
649
647
  p argv #=> ["aaa", "bbb"]
data/benry-cmdopt.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "benry-cmdopt"
5
- spec.version = "$Release: 2.0.0 $".split()[1]
5
+ spec.version = "$Release: 2.0.2 $".split()[1]
6
6
  spec.author = "kwatch"
7
7
  spec.email = "kwatch@gmail.com"
8
8
  spec.platform = Gem::Platform::RUBY
@@ -16,10 +16,9 @@ END
16
16
  spec.license = "MIT"
17
17
  spec.files = Dir[
18
18
  "README.md", "MIT-LICENSE", "CHANGES.md",
19
- "Rakefile.rb", "#{spec.name}.gemspec",
20
- "lib/**/*.rb", "test/**/*.rb", "task/**/*.rb",
21
- #"bin/*", "examples/**/*",
22
- "doc/*.html", "doc/css/*",
19
+ "#{spec.name}.gemspec",
20
+ "lib/**/*.rb", "test/**/*.rb", #"bin/*", "examples/**/*",
21
+ "doc/*.html", "doc/css/*.css",
23
22
  ]
24
23
  #spec.executables = []
25
24
  spec.bindir = "bin"