class Bashly::Commands::Completions
def install_completions
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
def installer
def installer @installer ||= Completely::Installer.new program: 'bashly', script_path: script_path end
def run
def run if args['--install'] install_completions elsif args['--uninstall'] uninstall_completions else puts script end end
def script
def script @script ||= asset_content('completions/bashly-completions.bash') end
def script_path
def script_path @script_path ||= asset('completions/bashly-completions.bash') end
def uninstall_completions
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