Skip to content
This repository was archived by the owner on Jan 31, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ajmichels/note-script",
"description": "A utility for note taking.",
"keywords": ["utility", "notes", "productivity", "markdown"],
"version": "0.1.0",
"version": "0.2.0",
"license": "GPL-2.0",
"type": "project",
"authors": [
Expand Down
12 changes: 11 additions & 1 deletion src/main/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function process()
$header = self::generateNoteHeader($date, $title);
$fileName = self::generateFileName($date, $title);
$filePath = sprintf('%s/%s.md', $this->config[Config::NOTE_DIR], $fileName);
$this->fileUtil->writeFile($filePath, $header);
$this->fileUtil->writeFile($filePath, $header . self::readStdIn());

return $filePath;
}
Expand Down Expand Up @@ -155,5 +155,15 @@ public static function generateNoteHeader(DateTime $date, $title = null)
return $header;
}

/**
* Retrieve any standard in content that was piped into the script.
* @return string
*/
public static function readStdIn()
{
// prevent the read from waiting for user input
stream_set_blocking(STDIN, 0);
return trim(stream_get_contents(STDIN));
}

}