class Bashly::Commands::Completions

Public Instance Methods

installer() click to toggle source
# File lib/bashly/commands/completions.rb, line 23
def installer
  @installer ||= Completely::Installer.new program: 'bashly', script_path: script_path
end
run() click to toggle source
# File lib/bashly/commands/completions.rb, line 13
def run
  if args['--install']
    install_completions
  elsif args['--uninstall']
    uninstall_completions
  else
    puts script
  end
end

Private Instance Methods

install_completions() click to toggle source
# File lib/bashly/commands/completions.rb, line 29
def install_completions
  success = installer.install force: true
  raise Error, "Failed running command:\nnb`#{installer.install_command_string}`" unless success

  say 'Completions installed'
  say "Source: m`#{installer.script_path}`"
  say "Target: m`#{installer.target_path}`"
  say 'Restart your session for the changes to take effect'
end
script() click to toggle source
# File lib/bashly/commands/completions.rb, line 51
def script
  @script ||= asset_content('completions/bashly-completions.bash')
end
script_path() click to toggle source
# File lib/bashly/commands/completions.rb, line 47
def script_path
  @script_path ||= asset('completions/bashly-completions.bash')
end
uninstall_completions() click to toggle source
# File lib/bashly/commands/completions.rb, line 39
def uninstall_completions
  success = installer.uninstall
  raise Error, "Failed running command:\nnb`#{installer.uninstall_command_string}`" unless success

  say 'Completions uninstalled'
  say 'Restart your session for the changes to take effect'
end