From 203f6d1944afe5707e7014dadb3e34c970f6e136 Mon Sep 17 00:00:00 2001 From: Brian Lopez Date: Wed, 4 Jun 2014 17:15:33 -0500 Subject: [PATCH] forgot to add the test fixture --- samples/Text/ISO-2022-KR.txt | 43 ++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 samples/Text/ISO-2022-KR.txt diff --git a/samples/Text/ISO-2022-KR.txt b/samples/Text/ISO-2022-KR.txt new file mode 100644 index 00000000..721d7051 --- /dev/null +++ b/samples/Text/ISO-2022-KR.txt @@ -0,0 +1,43 @@ +$)C# +# Out-AnsiGraph.psm1 +# Author: xcud +# History: +# v0.1 September 21, 2009 initial version +# +# PS Example> ps | select -first 5 | sort -property VM | +# Out-AnsiGraph ProcessName, VM +# AEADISRV  14508032 +# audiodg  50757632 +# conhost  73740288 +# AppleMobileDeviceService  92061696 +# btdna  126443520 +# +function Out-AnsiGraph($Parameter1=$null) { + BEGIN { + $q = new-object Collections.queue + $max = 0; $namewidth = 0; + } + + PROCESS { + if($_) { + $name = $_.($Parameter1[0]); + $val = $_.($Parameter1[1]) + if($max -lt $val) { $max = $val} + if($namewidth -lt $name.length) { + $namewidth = $name.length } + $q.enqueue(@($name, $val)) + } + } + + END { + $q | %{ + $graph = ""; 0..($_[1]/$max*20) | + %{ $graph += "" } + $name = "{0,$namewidth}" -f $_[0] + "$name $graph " + $_[1] + } + + } +} + +Export-ModuleMember Out-AnsiGraph \ No newline at end of file