Sha256: fefa71ed5bdb75d606fab6b65ee6764e96297c7481c7a5718deb5e9daaf1994e
Contents?: true
Size: 1.08 KB
Versions: 11
Compression:
Stored size: 1.08 KB
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 # rubocop:disable Style/BlockDelimiters def _ship_completion_bash_remove_lines(tau_completion) completion = tau_completion .strip.split("\n") .reject { |line| line.include? 'options+=("--help")' or line.include? 'options+=("-h")' } completion.pop completion.join("\n") end # rubocop:enable Style/BlockDelimiters # Remove bash completion functions def _ship_completion_bash_remove_functions(completion) functions = completion .split(/_tau[^_]*/) .select { |f| f =~ /_ship/ } .reject { |f| f =~ /_ship\n/ } .reject { |f| f.include? 'help ()' } functions.join('') end end
Version data entries
11 entries across 11 versions & 1 rubygems