-
-
Save namoscato/8b158853f984b124d90e48c7888c3bfa to your computer and use it in GitHub Desktop.
Copies Sequel Pro results as a GitHub and Jira Flavored Markdown table.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/php | |
| <?php | |
| $in = fopen('php://stdin', 'r'); | |
| $result = array(); | |
| $first = true; | |
| while ($line = fgetcsv($in, 0, "\t")) { | |
| $result[] = sprintf('|%s|', implode('|', $line)); | |
| if ($first) { | |
| $result[] = sprintf('|%s|', implode('|', array_fill(0, count($line), '---'))); | |
| $first = false; | |
| } | |
| } | |
| fclose($in); | |
| shell_exec(sprintf( | |
| 'echo %s | __CF_USER_TEXT_ENCODING=%s:0x8000100:0x8000100 pbcopy', | |
| escapeshellarg(implode("\n", $result)), | |
| posix_getuid() | |
| )); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/php | |
| <?php | |
| $in = fopen('php://stdin', 'r'); | |
| $result = array(); | |
| $first = true; | |
| while ($line = fgetcsv($in, 0, "\t")) { | |
| $delimiter = sprintf('|%s', $first ? '|' : ''); | |
| $result[] = sprintf( | |
| '%s%s%s', | |
| $delimiter, | |
| implode($delimiter, $line), | |
| $delimiter | |
| ); | |
| $first = false; | |
| } | |
| fclose($in); | |
| shell_exec(sprintf( | |
| 'echo %s | __CF_USER_TEXT_ENCODING=%s:0x8000100:0x8000100 pbcopy', | |
| escapeshellarg(implode("\n", $result)), | |
| posix_getuid() | |
| )); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage
Download, unzip, and add bundle command:
Select some results.
Bundles > Data Table > Copy > Copy as Markdown:
