Refactor password copying
Code re-use between copy and print commands