Created
October 5, 2016 07:50
-
-
Save daverogers/55b22c8de26a0fafff1a5103e2ee6f9e to your computer and use it in GitHub Desktop.
Copies Sequel Pro result into JIRA's table format. Save with the Bundle Editor (as new Copy bundle).
This file contains 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 | |
/* | |
* COPY AS JIRA TABLE by @daverogers | |
* Copies Sequel Pro result into JIRA's table format. Save with the Bundle Editor (as new Copy bundle). | |
* | |
* Thanks to @jakob-stoeck for his example Gist! | |
*/ | |
$in = fopen('php://stdin', 'r'); | |
$result = []; | |
$format = '||'; | |
while( $line = fgetcsv( $in, 0, "\t" ) ) { | |
$result[] = $format . implode( $format, $line ) . $format; | |
$format = '|'; | |
} | |
fclose( $in ); | |
$cmd = 'echo '.escapeshellarg( implode( "\n", $result ) ).' | __CF_USER_TEXT_ENCODING='.posix_getuid().':0x8000100:0x8000100 pbcopy'; | |
shell_exec( $cmd ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment