fxn / tkn

Terminal Keynote - A hack for terminal-based talks
MIT License
1.11k stars 84 forks source link

Check the file input #13

Closed kirs closed 8 years ago

kirs commented 8 years ago

Otherwise it crashes when I run it without the first arguments:

$ bin/tkn

bin/tkn:277:in `mtime': no implicit conversion of nil into String (TypeError)
    from bin/tkn:277:in `block in <main>'
    from bin/tkn:274:in `loop'
    from bin/tkn:274:in `<main>'

(I wanted to run the tkn binary without args to see the help)

fxn commented 8 years ago

The first check is fine.

The second one... I don't like generally check exists? manually. That's something you get automatically when you try to access the file. What if the file exists but permissions are not enough?

In principle I'd prefer that control near the mtime and/or load calls.

El jueves, 8 de octubre de 2015, Kir Shatrov notifications@github.com escribió:

Otherwise it crashes when I run it without the first arguments:

$ bin/tkn

bin/tkn:277:in mtime': no implicit conversion of nil into String (TypeError) from bin/tkn:277:inblock in

' from bin/tkn:274:in loop' from bin/tkn:274:in
'

(I wanted to run the tkn binary without args to see the help)

You can view, comment on, or merge this pull request online at:

https://github.com/fxn/tkn/pull/13 Commit Summary

  • Check file input

File Changes

Patch Links:

— Reply to this email directly or view it on GitHub https://github.com/fxn/tkn/pull/13.

Sent from Gmail Mobile

fxn commented 8 years ago

Ah! Also no need for blank? here, this is the command line, checking ARGV.length or nil? would suffice.