fewald-worklog 0.2.23 → 0.2.24
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/.version +1 -1
- data/lib/worklog.rb +13 -2
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 3a7181642148629e59e3614c32ef37ed26f26f7378938281a86aee3650e0b5ac
         | 
| 4 | 
            +
              data.tar.gz: 81f01771c514a785a167137bfec4bcbe30ea439b8463aead1e250457183ca1c7
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 4d06035360616307b8e2549507816646f5d84b1a8af39d5972501101715745d713bf3804331d588e0f58e5f420a67dc8425feb0e14f5a835d28ac1c5acfefbf7
         | 
| 7 | 
            +
              data.tar.gz: 716f3acd323acda5ee7be96bbb060615b21746fe7a3219a74276d7fc819679f4f3cad10b29e88c649e93dd1ff0b29d92f2f9ad1b61ce934accc5593d23ab8781
         | 
    
        data/.version
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            0.2. | 
| 1 | 
            +
            0.2.24
         | 
    
        data/lib/worklog.rb
    CHANGED
    
    | @@ -261,6 +261,7 @@ module Worklog | |
| 261 261 | 
             
                  end
         | 
| 262 262 | 
             
                end
         | 
| 263 263 |  | 
| 264 | 
            +
                # Show overview of all tags used in the work log including their count.
         | 
| 264 265 | 
             
                def tag_overview
         | 
| 265 266 | 
             
                  all_logs = @storage.all_days
         | 
| 266 267 | 
             
                  puts Rainbow('Tags used in the work log:').gold
         | 
| @@ -268,11 +269,21 @@ module Worklog | |
| 268 269 | 
             
                  # Count all tags used in the work log
         | 
| 269 270 | 
             
                  tags = all_logs.map(&:entries).flatten.map(&:tags).flatten.compact.tally
         | 
| 270 271 |  | 
| 272 | 
            +
                  # Calculate the maximum count for scaling the output if needed
         | 
| 273 | 
            +
                  max_count = tags.values.max || 0
         | 
| 274 | 
            +
                  factor = 32.0 / max_count # Scale to a maximum of 32 characters wide
         | 
| 275 | 
            +
             | 
| 276 | 
            +
                  # Calculate longest number length for formatting
         | 
| 277 | 
            +
                  num_length = max_count.to_s.length
         | 
| 278 | 
            +
             | 
| 271 279 | 
             
                  # Determine length of longest tag for formatting
         | 
| 272 | 
            -
                  # Add one  | 
| 280 | 
            +
                  # Add one additional space for formatting
         | 
| 273 281 | 
             
                  max_len = tags.empty? ? 0 : tags.keys.map(&:length).max + 1
         | 
| 274 282 |  | 
| 275 | 
            -
                  tags.sort.each  | 
| 283 | 
            +
                  tags.sort.each do |k, v|
         | 
| 284 | 
            +
                    print "#{Rainbow(k.to_s.rjust(max_len)).gold}: #{v.to_s.rjust(num_length)} "
         | 
| 285 | 
            +
                    puts '#' * (v * factor).ceil
         | 
| 286 | 
            +
                  end
         | 
| 276 287 | 
             
                end
         | 
| 277 288 |  | 
| 278 289 | 
             
                # Show detailed information about a specific tag
         |