Sha256: 56737c775e980f74d5b7d5d1343adc46ea7863cb0ee138780a9750561b8b672a

Contents?: true

Size: 835 Bytes

Versions: 22

Compression:

Stored size: 835 Bytes

Contents

# frozen_string_literal: true

# tau ship completion bash
module ShipCompletionBash
  # Print bash completion code
  def ship_completion_bash
    tau_completion = Takeltau::CLI.new.bash_fylla
    completion = _ship_completion_bash_remove_lines tau_completion
    completion = _ship_completion_bash_remove_functions completion
    completion << 'complete -F _ship ship'
    completion
  end

  private

  # Remove bash completion lines
  def _ship_completion_bash_remove_lines(tau_completion)
    completion =
      tau_completion
      .strip.split("\n")
    completion.pop
    completion.join("\n")
  end

  # Remove bash completion functions
  def _ship_completion_bash_remove_functions(completion)
    functions =
      completion
      .split(/_tau[^_]*/)
      .grep(/_ship/)
      .grep_v(/_ship\n/)
    functions.join
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
takeltau-0.45.11 lib/takeltau/ship/completion/bash.rb
takeltau-0.45.10 lib/takeltau/ship/completion/bash.rb
takeltau-0.45.9 lib/takeltau/ship/completion/bash.rb
takeltau-0.45.8 lib/takeltau/ship/completion/bash.rb
takeltau-0.45.6 lib/takeltau/ship/completion/bash.rb
takeltau-0.45.5 lib/takeltau/ship/completion/bash.rb
takeltau-0.45.4 lib/takeltau/ship/completion/bash.rb
takeltau-0.45.3 lib/takeltau/ship/completion/bash.rb
takeltau-0.45.2 lib/takeltau/ship/completion/bash.rb
takeltau-0.45.0 lib/takeltau/ship/completion/bash.rb
takeltau-0.44.42 lib/takeltau/ship/completion/bash.rb
takeltau-0.44.41 lib/takeltau/ship/completion/bash.rb
takeltau-0.44.39 lib/takeltau/ship/completion/bash.rb
takeltau-0.44.37 lib/takeltau/ship/completion/bash.rb
takeltau-0.44.36 lib/takeltau/ship/completion/bash.rb
takeltau-0.44.35 lib/takeltau/ship/completion/bash.rb
takeltau-0.44.29 lib/takeltau/ship/completion/bash.rb
takeltau-0.44.27 lib/takeltau/ship/completion/bash.rb
takeltau-0.44.24 lib/takeltau/ship/completion/bash.rb
takeltau-0.44.23 lib/takeltau/ship/completion/bash.rb