chiark / gitweb /
commitid: Pass $what to genform* (nfc)
[reprap-play.git] / commitid.scad.pl
index 68bd4cebf441b09ad4c66edc9e09746e9e7229eb..8bd4aa71e507d46b1ae6e5a2d588e8a9ac4499f2 100755 (executable)
@@ -429,9 +429,10 @@ our $argcounter;
 
 our @forms;
 
-sub rjustt ($$;$) { # right justify and truncate (ie, pad and truncate at left)
-                    # always includes prefix
-    my ($sz, $whole, $prefix) = @_;
+sub rjustt ($$$;$) {
+    # right justify and truncate (ie, pad and truncate at left)
+    # always includes prefix
+    my ($sz, $what, $whole, $prefix) = @_;
     $prefix //= '';
     my $lw = length $whole;
     my $spare = $sz - $lw - (length $prefix);
@@ -441,8 +442,8 @@ sub rjustt ($$;$) { # right justify and truncate (ie, pad and truncate at left)
        substr($whole, ($spare < 0 ? -$spare : 0));
 }
 
-sub ljustt ($$;$) {
-    my ($sz, $whole, $suffix) = @_;
+sub ljustt ($$$;$) {
+    my ($sz, $what, $whole, $suffix) = @_;
     $suffix //= '';
     $sz -= length $suffix;
     return sprintf "%-${sz}.${sz}s%s", $whole, $suffix;
@@ -537,29 +538,29 @@ sub do_git () {
        gentextmodule_demo_start_batch();
 
        if (defined($git_count)) {
-           my $smallstr = rjustt($sz, $git_count, $git_dirty);
+           my $smallstr = rjustt($sz, 'Count', $git_count, $git_dirty);
            my $forgitobj = $sz - length($git_count) - 1;
            if (defined($git_object) && $forgitobj >= 2) {
-               $smallstr = ljustt($forgitobj, $git_object).
+               $smallstr = ljustt($forgitobj, 'Objid', $git_object).
                    ($git_dirty || ' ').
                    $git_count;
            }
            genform_plusq("Small$sz", $smallstr);
        }
 
-       genform_plusq("Git$sz", ljustt($sz, $git_object, $git_dirty))
+       genform_plusq("Git$sz", ljustt($sz, 'Objid', $git_object, $git_dirty))
            if defined $git_object;
 
        if (defined $git_count && defined $git_object) {
            genform("Full".($sz*2),
-                   ljustt($sz, $git_object),
-                   rjustt($sz, $git_count, $git_dirty));
+                   ljustt($sz, 'Objid', $git_object),
+                   rjustt($sz, 'Count', $git_count, $git_dirty));
 
            my $e = $sz;
            genform("Full".($e*3)."T",
-                   ljustt($e*2, $git_object, $git_dirty)
+                   ljustt($e*2, 'Objid', $git_object, $git_dirty)
                    =~ m/.{$e}/g,
-                   rjustt($e, $git_count));
+                   rjustt($e, 'Count', $git_count));
        }
     }
 }