Class: Bashly::Libraries::CompletionsFunction

Inherits:
Base
  • Object
show all
Defined in:
lib/bashly/libraries/completions/completions_function.rb

Instance Attribute Summary

Attributes inherited from Base

#args

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Bashly::Libraries::Base

Instance Method Details

#filesObject



4
5
6
7
8
9
10
11
# 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_messageObject



13
14
15
16
17
18
19
20
21
# 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