Sha256: 6a8b276aec8a1e94e6be95a3ead8c1c22704e9707a5370242e481caaab5bfd5c
Contents?: true
Size: 908 Bytes
Versions: 6
Compression:
Stored size: 908 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[^_]*/) .select { |f| f =~ /_ship/ } .reject { |f| f =~ /_ship\n/ } .reject { |f| f.include? 'help ()' } functions.join('') end end
Version data entries
6 entries across 6 versions & 1 rubygems