piotrmurach / tty

Toolkit for developing sleek command line apps.
https://ttytoolkit.org
MIT License
2.5k stars 78 forks source link

Getting a success indicator in TTY::File.copy_file() #74

Closed rom3r4 closed 3 years ago

rom3r4 commented 3 years ago

Describe the problem

I noticed that unlike TTY::File.copy_directory(), TTY::File.copy_file() does't return a value on success. Would be possible that both methods behave similar?

Steps to reproduce the problem

# Need of rescuing the method in order to know about the success 

begin
  TTY::File.copy_file(  ...  )
rescue
  success = false
  ...
else
  success = true
end

Actual behaviour

result = TTY::File.copy_file()
# result == nil in both error and success

Expected behaviour

Equivalent to its 'brother' method TTY::File.copy_directory()

Describe your environment

piotrmurach commented 3 years ago

Thank you for the report. 💯 Agreed. Sorry to be a pain but would you mind reposting this in the tty-file project issue tracker. And if you have time to submit PR I'd be most grateful.

rom3r4 commented 3 years ago

No problem. Moved the issue to tty-file - Issue13

Sure, working on the PR