How to print nicely in MacOS terminal path with spaces using pwd

Something that was bothering me in the past - if I would need to copy paste a path in terminal that have spaces, then I would have to escape spaces manually, which is annoying and slow. Thanks to AI I know have this alias:

alias pwd="printf '%q\n' \"$(pwd)\""

which does exactly what you need. You can even do ppwd | pbcoy to get that path to your clipboard in one command.

Happy coding :)