@@ -4,14 +4,17 @@ class Completions < Base
44 summary 'Install bash completions for bashly itself'
55 help 'Display the bash completions script or install it directly to your bash completions directory'
66
7- usage 'bashly completions [--install]'
7+ usage 'bashly completions [--install --uninstall ]'
88 usage 'bashly completions (-h|--help)'
99
1010 option '-i --install' , 'Install the completions script to your bash completions directory'
11+ option '-u --uninstall' , 'Uninstall the completions script from your bash completions directory'
1112
1213 def run
1314 if args [ '--install' ]
1415 install_completions
16+ elsif args [ '--uninstall' ]
17+ uninstall_completions
1518 else
1619 puts script
1720 end
@@ -25,14 +28,22 @@ def installer
2528
2629 def install_completions
2730 success = installer . install force : true
28- raise Error , "Failed running command:\n nb`#{ installer . command_string } `" unless success
31+ raise Error , "Failed running command:\n nb`#{ installer . install_command_string } `" unless success
2932
30- say 'Completions installed. '
33+ say 'Completions installed'
3134 say "Source: m`#{ installer . script_path } `"
3235 say "Target: m`#{ installer . target_path } `"
3336 say 'Restart your session for the changes to take effect'
3437 end
3538
39+ def uninstall_completions
40+ success = installer . uninstall
41+ raise Error , "Failed running command:\n nb`#{ installer . uninstall_command_string } `" unless success
42+
43+ say 'Completions uninstalled'
44+ say 'Restart your session for the changes to take effect'
45+ end
46+
3647 def script_path
3748 @script_path ||= asset ( 'completions/bashly-completions.bash' )
3849 end
0 commit comments