<pre style='margin:0'>
Rainer Müller (raimue) pushed a commit to branch master
in repository macports-contrib.
</pre>
<p><a href="https://github.com/macports/macports-contrib/commit/36ff36b5db518c02f14a6633bf5debb89455762f">https://github.com/macports/macports-contrib/commit/36ff36b5db518c02f14a6633bf5debb89455762f</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 36ff36b5db518c02f14a6633bf5debb89455762f
</span>Author: Rainer Müller <raimue@macports.org>
AuthorDate: Tue Mar 27 08:00:32 2018 +0200
<span style='display:block; white-space:pre;color:#404040;'> cargo2port: Add --align=maxlen command-line option
</span>---
cargo2port/cargo2port.tcl | 29 ++++++++++++++++++++++++-----
1 file changed, 24 insertions(+), 5 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/cargo2port/cargo2port.tcl b/cargo2port/cargo2port.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index fb360b1..282097f 100755
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/cargo2port/cargo2port.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/cargo2port/cargo2port.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -42,18 +42,33 @@ proc dequote {str} {
</span> return [string trim $str "\""]
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+proc usage {code} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts stderr "Usage: [file tail $::argv0] \[--align=maxlen\] <path/to/Cargo.lock>"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ exit $code
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> # main
<span style='display:block; white-space:pre;background:#ffe0e0;'>-if {$argc != 1} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts stderr "Usage: [file tail $argv0] <path/to/Cargo.lock>"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- exit 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if {$argc == 0} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ usage 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+} elseif {$argc == 1} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set maxlenmode no
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set cargolock [lindex $argv 0]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+} elseif {$argc == 2} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[lindex $argv 0] ne "--align=maxlen"} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ usage 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set maxlenmode yes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set cargolock [lindex $argv 1]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+} else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ usage 1
</span> }
set crates {}
set maxlen_name 0
set maxlen_version 0
<span style='display:block; white-space:pre;background:#ffe0e0;'>-set fd [ini::open [lindex $argv 0] "r"]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+set fd [ini::open $cargolock "r"]
</span> set metadata [ini::get $fd metadata]
ini::close $fd
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -79,7 +94,11 @@ foreach crate $crates {
</span> set name [lindex $crate 0]
set version [lindex $crate 1]
set checksum [lindex $crate 2]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- puts -nonewline [format " %-*s %-*s %s" $maxlen_name $name $maxlen_version $version $checksum]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$maxlenmode} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts -nonewline [format " %-*s %-*s %s" $maxlen_name $name $maxlen_version $version $checksum]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts -nonewline [format " %s %s %s" $name $version $checksum]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> }
puts ""
</pre><pre style='margin:0'>
</pre>