Class: PGit::Installer::BashAutoCompletion
- Inherits:
-
Object
- Object
- PGit::Installer::BashAutoCompletion
- Defined in:
- lib/pgit/installer/bash_auto_completion.rb
Constant Summary collapse
- FILENAME =
"~/.pgit_auto_completion"
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(global_opts, opts, args) ⇒ BashAutoCompletion
constructor
A new instance of BashAutoCompletion.
- #source_completer_from_bashrc ⇒ Object
- #write_completer_file ⇒ Object
Constructor Details
#initialize(global_opts, opts, args) ⇒ BashAutoCompletion
Returns a new instance of BashAutoCompletion.
22 23 |
# File 'lib/pgit/installer/bash_auto_completion.rb', line 22 def initialize(global_opts, opts, args) end |
Class Method Details
.script ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/pgit/installer/bash_auto_completion.rb', line 6 def self.script autocompletion = <<-AUTOCOMPLETION function get_pgit_commands { if [ -z $2 ]; then COMPREPLY=(`pgit help -c`) else COMPREPLY=(`pgit help -c $2`) fi } complete -F get_pgit_commands pgit AUTOCOMPLETION PGit::Helpers::Heredoc.remove_front_spaces(autocompletion) end |
Instance Method Details
#source_completer_from_bashrc ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/pgit/installer/bash_auto_completion.rb', line 34 def source_completer_from_bashrc if already_sourced? puts "Already sourcing #{FILENAME} in ~/.bashrc" else = File.("~/.bashrc") b = File.open(, 'a') b.puts "source #{FILENAME}" b.close puts "~/.bashrc will now source #{FILENAME}" end end |