navid/veins / commit
8557ab995058
Navid M <navidmomtahen@gmail.com> · 2026-11-26
parents: d26c4e3bfd08
Browse files at this commit · Download source
--- a/veins/src/cli/hash_cmd.sx+++ b/veins/src/cli/hash_cmd.sx@@ -41,6 +41,7 @@ pub fn run(args: list[ref u8], start: usize) i32 = trust { val rev: mut bytes.Bytes = bytes.empty()+ val short: mut bool = false val end_flags: mut bool = false val i: mut usize = start for i < @len(args) {@@ -48,6 +49,10 @@ if o is some a { if !end_flags && cmd_is(a, c"--", 2) { end_flags = true+ } elif !end_flags && cmd_is(a, c"-short", 6) {+ short = true+ } elif !end_flags && cmd_is(a, c"-long", 5) {+ short = false } elif !end_flags && (cmd_is(a, c"-r", 2) || cmd_is(a, c"-rev", 4)) { if i + 1 < @len(args) { val v = @get(args, i + 1)@@ -125,7 +130,11 @@ } val hex: ref u8 = objid.Id.hex(target)- stdio.print("{s}\n", {str.view(hex, 64)})+ val width: mut usize = 64+ if short {+ width = 12+ }+ stdio.print("{s}\n", {str.view(hex, width)}) @free(hex as ref void) free_id(target) store.close(st)--- a/veins/src/cli/help_cmd.sx+++ b/veins/src/cli/help_cmd.sx@@ -207,9 +207,9 @@ } fn show_hash() void = trust {- stdio.puts("usage: vn hash [rev]")+ stdio.puts("usage: vn hash [rev] [-short|-long]") stdio.puts("")- stdio.puts("print the full commit hash for a revision")+ stdio.puts("print the commit hash for a revision") stdio.puts("") stdio.puts("arguments:") stdio.puts(" [rev] revision to hash (default: @)")@@ -216,6 +216,8 @@ stdio.puts("") stdio.puts("options:") stdio.puts(" -rev <rev> revision to hash")+ stdio.puts(" -short print the 12-character abbreviated hash")+ stdio.puts(" -long print the full 64-character hash (default)") } fn show_bookmark() void = trust {