git_selector 0.2.1 → 0.2.2
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/Gemfile.lock +1 -1
- data/lib/git_selector/version.rb +1 -1
- data/lib/monkey_patches/tty/prompt/list.rb +12 -0
- data/lib/monkey_patches/tty/prompt.rb +42 -0
- metadata +3 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: cb239a7bd25eb04147c34c2abf08b85a0011c340de26c5ec6ab432f199fdcc68
         | 
| 4 | 
            +
              data.tar.gz: b1d5fb88077a842a73e49906f23595920fca485272d3da4ca5d101d01da17e29
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: ad33d9bf74f706bd203588628ad0fc4a91936545c8e50755791331481cb7e2e413c64b667a5bd21de7852b733005783a1b6203a0d7d02725da3681a99b566634
         | 
| 7 | 
            +
              data.tar.gz: c4ff0b4254aaf8bc701790b64ec3bd2ada32e1b31a825db122b7dc5da4043bebf62473c837b77056d24312e8df2e59d3d84a98c10c4a8b083d33e383fe6332b1
         | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/lib/git_selector/version.rb
    CHANGED
    
    
| @@ -0,0 +1,42 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require_relative '../../git_prompt.rb'
         | 
| 4 | 
            +
            require_relative './prompt/list.rb'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            module TTY
         | 
| 7 | 
            +
              class Prompt
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                # original - https://github.com/piotrmurach/tty-prompt/blob/master/lib/tty/prompt.rb#L226-L250
         | 
| 10 | 
            +
                def invoke_select(object, question, *args, &block)
         | 
| 11 | 
            +
                  options = Utils.extract_options!(args)
         | 
| 12 | 
            +
                  choices = if args.empty? && !block
         | 
| 13 | 
            +
                              possible = options.dup
         | 
| 14 | 
            +
                              options = {}
         | 
| 15 | 
            +
                              possible
         | 
| 16 | 
            +
                            elsif args.size == 1 && args[0].is_a?(Hash)
         | 
| 17 | 
            +
                              Utils.extract_options!(args)
         | 
| 18 | 
            +
                            else
         | 
| 19 | 
            +
                              args.flatten
         | 
| 20 | 
            +
                            end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                  @list = object.new(self, **options)
         | 
| 23 | 
            +
                  @list.(question, choices, &block)
         | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                def unsubscribe_list
         | 
| 27 | 
            +
                  self.unsubscribe(@list)
         | 
| 28 | 
            +
                end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                def clear_list
         | 
| 31 | 
            +
                  @done = true
         | 
| 32 | 
            +
                  # @list = nil
         | 
| 33 | 
            +
                  unsubscribe_list
         | 
| 34 | 
            +
                  # 2 is for the prompt message
         | 
| 35 | 
            +
                  print(TTY::Cursor.clear_lines(GitPrompt::SELECT_OPTIONS_PER_PAGE + 2, :up))
         | 
| 36 | 
            +
                end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                def purge_list
         | 
| 39 | 
            +
                  @list = nil
         | 
| 40 | 
            +
                end
         | 
| 41 | 
            +
              end
         | 
| 42 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: git_selector
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.2. | 
| 4 | 
            +
              version: 0.2.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Tatsuya Suzuki
         | 
| @@ -76,6 +76,8 @@ files: | |
| 76 76 | 
             
            - lib/git_prompt.rb
         | 
| 77 77 | 
             
            - lib/git_selector.rb
         | 
| 78 78 | 
             
            - lib/git_selector/version.rb
         | 
| 79 | 
            +
            - lib/monkey_patches/tty/prompt.rb
         | 
| 80 | 
            +
            - lib/monkey_patches/tty/prompt/list.rb
         | 
| 79 81 | 
             
            - lib/treeish_extractor.rb
         | 
| 80 82 | 
             
            homepage: https://github.com/suzukimilanpaak/git_selector
         | 
| 81 83 | 
             
            licenses:
         |