class Bashly::Libraries::CompletionsFunction
Public Instance Methods
files()
click to toggle source
# File lib/bashly/libraries/completions/completions_function.rb, line 4 def files [ { path: "#{Settings.full_lib_dir}/#{function_name}.#{Settings.partials_extension}", content: completions_function_code(function_name), }, ] end
post_install_message()
click to toggle source
# File lib/bashly/libraries/completions/completions_function.rb, line 13 def post_install_message <<~MESSAGE In order to enable completions in your script, create a command or a flag (for example: g`#{command.name} completions` or g`#{command.name} --completions`) that calls the g`#{function_name}` function. Your users can then run something like this to enable completions: m`$ eval "$(#{command.name} completions)"` MESSAGE end
Private Instance Methods
completions_function_code(function_name)
click to toggle source
# File lib/bashly/libraries/completions/completions_function.rb, line 29 def completions_function_code(function_name) [ "## [@bashly-upgrade completions #{function_name}]", command.completion_function(function_name), ].join "\n" end
function_name()
click to toggle source
# File lib/bashly/libraries/completions/completions_function.rb, line 25 def function_name @function_name ||= args[0] || 'send_completions' end