Renamed text in Text

This commit is contained in:
Paul Chaignon
2014-12-11 12:51:09 -05:00
parent f93272f0bd
commit db70630eaa
9 changed files with 18 additions and 18 deletions

View File

@@ -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

1
samples/Text/foo.txt Normal file
View File

@@ -0,0 +1 @@
foo

1
samples/Text/mac.txt Normal file
View File

@@ -0,0 +1 @@
line 1

1
samples/Text/messages.fr Normal file
View File

@@ -0,0 +1 @@
the green potato=la pomme de terre verte

1
samples/Text/readme.txt Normal file
View File

@@ -0,0 +1 @@
Read me now!