Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@daverogers
Created October 5, 2016 07:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daverogers/55b22c8de26a0fafff1a5103e2ee6f9e to your computer and use it in GitHub Desktop.
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).
#!/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