class Chid::Commands::Alias::Create
Public Instance Methods
run()
click to toggle source
# File lib/chid/commands/alias/create.rb, line 22 def run add_command_on_bashrc print "Please run: source ~/.bashrc".blue end
Private Instance Methods
add_command_on_bashrc()
click to toggle source
# File lib/chid/commands/alias/create.rb, line 30 def add_command_on_bashrc File.open(bashrc_path, 'a') { |file| file.puts shell_command } end
alias_value()
click to toggle source
# File lib/chid/commands/alias/create.rb, line 42 def alias_value options['-alias'].first end
bashrc_path()
click to toggle source
# File lib/chid/commands/alias/create.rb, line 34 def bashrc_path @bashrc_path ||= File.join(Dir.home, '.bashrc') end
command()
click to toggle source
# File lib/chid/commands/alias/create.rb, line 46 def command options['-command'].first end
shell_command()
click to toggle source
# File lib/chid/commands/alias/create.rb, line 38 def shell_command "alias #{alias_value}='#{command}'" end