mirror of
https://github.com/erusev/parsedown.git
synced 2024-09-20 03:51:29 +02:00
Check if argument is a file
This commit is contained in:
parent
e08fba07d2
commit
103cd6deb3
@ -6,9 +6,14 @@ require(dirname(__FILE__).'/Parsedown.php');
|
||||
// From a file
|
||||
if (isset($argv[1])) {
|
||||
|
||||
if ( ! is_file($argv[1])) {
|
||||
printf('"%s" is not a file', $argv[1]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ( ! is_readable($argv[1])) {
|
||||
printf('Count not read "%s"', $argv[1]);
|
||||
exit(1);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
$markdown = file_get_contents($argv[1]);
|
||||
|
Loading…
Reference in New Issue
Block a user