Skip to content

Commit

Permalink
Actually use user's ~/.psqlrc file
Browse files Browse the repository at this point in the history
  • Loading branch information
rafbm committed Oct 17, 2024
1 parent 9e1c006 commit a5719e6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cb/psql.cr
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ module CB
s << "%[%033[36m%]#{c.name}%[%033m%]"
end

user_psqlrc = File.expand_path("~/.psqlrc", home: true)
psqlrc = File.tempfile(c.id, "psqlrc")
File.copy("~/.psqlrc", psqlrc.path) if File.exists?("~/.psqlrc")
File.copy(user_psqlrc, psqlrc.path) if File.exists?(user_psqlrc)
File.open(psqlrc.path, "a") do |f|
f.puts "\\set ON_ERROR_ROLLBACK interactive"
f.puts "\\set PROMPT1 '#{psqlpromptname}/%[%033[33;1m%]%x%x%x%[%033[0m%]%[%033[1m%]%/%[%033[0m%]%R%# '"
Expand Down

0 comments on commit a5719e6

Please sign in to comment.