Skip to content

Commit

Permalink
adding cli_helper file
Browse files Browse the repository at this point in the history
  • Loading branch information
GSto committed Jan 8, 2013
1 parent ee5a13a commit bdf0dc4
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
@@ -1,4 +1,4 @@
cli_helper
==========

Helper functions for writing command line scripts in CodeIgniter
Helper functions for writing command line scripts in CodeIgniter.
53 changes: 53 additions & 0 deletions cli_helper.php
@@ -0,0 +1,53 @@
<?php
/**
* Command Line Helper
*
* functions to assist in writing CLI scripts
*
* @package cli_hepler
* @author Glenn Stovall
* @version 1.0
*/

/**
* print line
*
* @param string
* @return null
*/
function pl($input)
{
echo $input . PHP_EOL;
}

/**
* prints an array in a human-readable format
*
* @param array
* @return null
*
*/
function pl_array($input)
{
if(!empty($input) && is_array($input)) {
foreach($input as $key => $value) {
pl("[" .$key. "] => " . $value);
}
}
}

/**
* prints a horizontal line break
*
* @param int
* @return null
*
*/
function line_break($length = 40)
{
$output = "";
for($i = 0; $i < $length; $i++) {
$output .= '-';
}
return $output;
}

0 comments on commit bdf0dc4

Please sign in to comment.