shellopts 2.0.13 → 2.0.14
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/TODO +20 -0
 - data/lib/shellopts/program.rb +25 -22
 - data/lib/shellopts/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: 2101f633ad0e166982b108842a83f91b3d216869f9fe3d6ac7ecea5256f2b437
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: da77f695902e5e921e598dd8d1327af4ce07ffe7b9cfadb88fe1b0889b95b4e0
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 36dbd8d33d74a5b985463df5fb514501c2881881bdd68f1fa479c7ecac3de2bc4a2bc3a713acfe735d3e53ccdde10f5abf5ecc066d370fa8e795a77e290f9988
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: b364c8d00de2f7ece58d3c721ef3d4f40a892a232aa39a0c94df2b7ef37cf86e78c99df25c07e8802b0e48640ec928c4157bd89a2cb0851955484ed5957733ca
         
     | 
    
        data/TODO
    CHANGED
    
    | 
         @@ -1,4 +1,24 @@ 
     | 
|
| 
       1 
1 
     | 
    
         | 
| 
      
 2 
     | 
    
         
            +
            o In the following list is a command with a mandatory sub-command
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
              list.tables!
         
     | 
| 
      
 5 
     | 
    
         
            +
              list.uuids!
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              It should be rendered as
         
     | 
| 
      
 8 
     | 
    
         
            +
                list tables|uuids
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              and not as
         
     | 
| 
      
 11 
     | 
    
         
            +
                list tables
         
     | 
| 
      
 12 
     | 
    
         
            +
                list uuids
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              and not as 
         
     | 
| 
      
 15 
     | 
    
         
            +
                list [tables|uuids]
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            o Replace -h with -? when -h is specified by the user (eg. as a shorthand for --host)
         
     | 
| 
      
 19 
     | 
    
         
            +
            o Limit text width to -10 chars of what it is today (same as stackexchange width in characters)
         
     | 
| 
      
 20 
     | 
    
         
            +
            o Fix formatting error in long arguments (see ms2pg)
         
     | 
| 
      
 21 
     | 
    
         
            +
            o Macro that can be used in the SPEC for the program name (eg. <PROGRAM>)
         
     | 
| 
       2 
22 
     | 
    
         
             
            o Ignore all text after ' # ' (doesn't conflict with option flag)
         
     | 
| 
       3 
23 
     | 
    
         
             
            o Command aliases
         
     | 
| 
       4 
24 
     | 
    
         
             
            o Add user-defined setions
         
     | 
    
        data/lib/shellopts/program.rb
    CHANGED
    
    | 
         @@ -194,33 +194,36 @@ module ShellOpts 
     | 
|
| 
       194 
194 
     | 
    
         | 
| 
       195 
195 
     | 
    
         
             
                def __define_option_methods__
         
     | 
| 
       196 
196 
     | 
    
         
             
                  @__grammar__.options.each { |opt|
         
     | 
| 
       197 
     | 
    
         
            -
                    if opt.argument? 
     | 
| 
       198 
     | 
    
         
            -
                       
     | 
| 
       199 
     | 
    
         
            -
                         
     | 
| 
       200 
     | 
    
         
            -
                           
     | 
| 
       201 
     | 
    
         
            -
                             
     | 
| 
       202 
     | 
    
         
            -
             
     | 
| 
       203 
     | 
    
         
            -
                             
     | 
| 
       204 
     | 
    
         
            -
                              default
         
     | 
| 
       205 
     | 
    
         
            -
                            end
         
     | 
| 
      
 197 
     | 
    
         
            +
                    if opt.argument?
         
     | 
| 
      
 198 
     | 
    
         
            +
                      self.instance_eval %(
         
     | 
| 
      
 199 
     | 
    
         
            +
                        def #{opt.attr}(default = nil)
         
     | 
| 
      
 200 
     | 
    
         
            +
                          if @__option_values__.key?(:#{opt.attr}) 
         
     | 
| 
      
 201 
     | 
    
         
            +
                            @__option_values__[:#{opt.attr}]
         
     | 
| 
      
 202 
     | 
    
         
            +
                          else
         
     | 
| 
      
 203 
     | 
    
         
            +
                            default
         
     | 
| 
       206 
204 
     | 
    
         
             
                          end
         
     | 
| 
       207 
     | 
    
         
            -
                         
     | 
| 
       208 
     | 
    
         
            -
                       
     | 
| 
       209 
     | 
    
         
            -
             
     | 
| 
       210 
     | 
    
         
            -
             
     | 
| 
       211 
     | 
    
         
            -
             
     | 
| 
       212 
     | 
    
         
            -
             
     | 
| 
       213 
     | 
    
         
            -
             
     | 
| 
       214 
     | 
    
         
            -
             
     | 
| 
       215 
     | 
    
         
            -
             
     | 
| 
      
 205 
     | 
    
         
            +
                        end
         
     | 
| 
      
 206 
     | 
    
         
            +
                      )
         
     | 
| 
      
 207 
     | 
    
         
            +
             
     | 
| 
      
 208 
     | 
    
         
            +
                    elsif opt.repeatable?
         
     | 
| 
      
 209 
     | 
    
         
            +
                      self.instance_eval %(
         
     | 
| 
      
 210 
     | 
    
         
            +
                        def #{opt.attr}(default = 0) 
         
     | 
| 
      
 211 
     | 
    
         
            +
                          if default > 0 && @__option_values__[:#{opt.attr}] == 0
         
     | 
| 
      
 212 
     | 
    
         
            +
                            default
         
     | 
| 
      
 213 
     | 
    
         
            +
                          else
         
     | 
| 
      
 214 
     | 
    
         
            +
                            @__option_values__[:#{opt.attr}]
         
     | 
| 
       216 
215 
     | 
    
         
             
                          end
         
     | 
| 
       217 
     | 
    
         
            -
                         
     | 
| 
       218 
     | 
    
         
            -
                       
     | 
| 
       219 
     | 
    
         
            -
             
     | 
| 
       220 
     | 
    
         
            -
                      end
         
     | 
| 
      
 216 
     | 
    
         
            +
                        end
         
     | 
| 
      
 217 
     | 
    
         
            +
                      )
         
     | 
| 
      
 218 
     | 
    
         
            +
                    else
         
     | 
| 
      
 219 
     | 
    
         
            +
                      self.instance_eval("def #{opt.attr}() @__option_values__[:#{opt.attr}] end")
         
     | 
| 
      
 220 
     | 
    
         
            +
                    end
         
     | 
| 
      
 221 
     | 
    
         
            +
             
     | 
| 
      
 222 
     | 
    
         
            +
                    if opt.argument? || opt.repeatable?
         
     | 
| 
       221 
223 
     | 
    
         
             
                      self.instance_eval("def #{opt.attr}=(value) @__option_values__[:#{opt.attr}] = value end")
         
     | 
| 
       222 
224 
     | 
    
         
             
                      @__option_values__[opt.attr] = 0 if !opt.argument?
         
     | 
| 
       223 
225 
     | 
    
         
             
                    end
         
     | 
| 
      
 226 
     | 
    
         
            +
             
     | 
| 
       224 
227 
     | 
    
         
             
                    self.instance_eval("def #{opt.attr}?() @__option_values__.key?(:#{opt.attr}) end")
         
     | 
| 
       225 
228 
     | 
    
         
             
                  }
         
     | 
| 
       226 
229 
     | 
    
         | 
    
        data/lib/shellopts/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: shellopts
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 2.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.0.14
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Claus Rasmussen
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2022-04- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-04-05 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: forward_to
         
     |