diff options
| author | Bobby <[email protected]> | 2026-01-28 10:50:14 +0530 |
|---|---|---|
| committer | Bobby <[email protected]> | 2026-01-28 10:50:14 +0530 |
| commit | a65d580d866b08576d5f2b69ca3ca082df98aa3f (patch) | |
| tree | 164e133f075b4ee7c1d824d2ff6c338c5dcf9964 | |
| parent | 250c05bec6627fa21863e8c4d715d5d2da8ef562 (diff) | |
| download | akiba-a65d580d866b08576d5f2b69ca3ca082df98aa3f.tar.xz akiba-a65d580d866b08576d5f2b69ca3ca082df98aa3f.zip | |
feat: Update stack viewer to include owner, permissions, and modified time details
| -rw-r--r-- | Makefile | 3 | ||||
| -rw-r--r-- | binaries/mi/mi.zig | 64 | ||||
| -rw-r--r-- | mirai/ash/ash.zig | 3 | ||||
| -rw-r--r-- | mirai/fs/afs.zig | 1 | ||||
| -rw-r--r-- | mirai/invocations/viewstack.zig | 6 | ||||
| -rw-r--r-- | system/libraries/akiba/io.zig | 6 |
6 files changed, 49 insertions, 34 deletions
@@ -52,8 +52,9 @@ docker-build: @echo "═══════════════════════════════════════════════════════════" @echo " Building Akiba OS (Docker mode)" @echo "═══════════════════════════════════════════════════════════" + @echo "Setting Docker time to: $(shell date -u)" @docker build -t akiba-builder ./toolchain - @docker run --rm -v $(PWD):/akiba -e DOCKER_BUILD=1 akiba-builder make all + @docker run --rm -v $(PWD):/akiba -e BUILD_DATE="$(shell date -u)" -e DOCKER_BUILD=1 akiba-builder sh -c 'echo "Docker received date: $$BUILD_DATE" && date -s "$$BUILD_DATE" >/dev/null 2>&1 || true && echo "Docker current time: $$(date -u)" && make all' docker-run: @./scripts/run.sh diff --git a/binaries/mi/mi.zig b/binaries/mi/mi.zig index a50a6d4..5168b0d 100644 --- a/binaries/mi/mi.zig +++ b/binaries/mi/mi.zig @@ -30,29 +30,43 @@ fn display_stack(path: []const u8) !void { var entries: [128]akiba.io.StackEntry = undefined; const count = akiba.io.viewstack(path, &entries) catch 0; - _ = akiba.io.mark(akiba.io.stream, "\nAccess", Color.gray) catch 0; - print_padding(2); - _ = akiba.io.mark(akiba.io.stream, "Size", Color.gray) catch 0; - print_padding(2); - _ = akiba.io.mark(akiba.io.stream, "Persona", Color.gray) catch 0; - print_padding(2); - _ = akiba.io.mark(akiba.io.stream, "Modified", Color.gray) catch 0; - print_padding(9); - _ = akiba.io.mark(akiba.io.stream, "Name\n", Color.gray) catch 0; + // Calculate max widths for each column + var max_access_len: usize = 6; // "Access" header + var max_size_len: usize = 4; // "Size" header + var max_owner_len: usize = 7; // "Persona" header + var max_date_len: usize = 8; // "Modified" header + const formatted_date_len: usize = 19; // All dates format to " 1 Jan 1970 00:00 " + if (formatted_date_len > max_date_len) max_date_len = formatted_date_len; - var stack_count: usize = 0; - var unit_count: usize = 0; - var total_size: u64 = 0; - - // Calculate max owner name length - var max_owner_len: usize = 7; // "Persona" header length for (0..count) |i| { const entry = &entries[i]; + const perms = get_permissions(entry.permission_type); + if (perms.len > max_access_len) max_access_len = perms.len; + + var size_buf: [32]u8 = undefined; + const size_str = format_size(entry.size, &size_buf); + if (size_str.len > max_size_len) max_size_len = size_str.len; + if (entry.owner_name_len > max_owner_len) { max_owner_len = entry.owner_name_len; } } + // Print header + _ = akiba.io.mark(akiba.io.stream, "\nAccess", Color.white) catch 0; + print_padding(max_access_len - 6 + 2); + _ = akiba.io.mark(akiba.io.stream, "Size", Color.white) catch 0; + print_padding(max_size_len - 4 + 2); + _ = akiba.io.mark(akiba.io.stream, "Persona", Color.white) catch 0; + print_padding(max_owner_len - 7 + 3); + _ = akiba.io.mark(akiba.io.stream, "Modified", Color.white) catch 0; + print_padding(max_date_len - 8 + 1); + _ = akiba.io.mark(akiba.io.stream, "Name\n", Color.white) catch 0; + + var stack_count: usize = 0; + var unit_count: usize = 0; + var total_size: u64 = 0; + for (0..count) |i| { const entry = &entries[i]; const identity = entry.identity[0..entry.identity_len]; @@ -60,18 +74,18 @@ fn display_stack(path: []const u8) !void { const perms = get_permissions(entry.permission_type); _ = akiba.io.mark(akiba.io.stream, perms, Color.cyan) catch 0; - print_padding(if (perms.len < 10) 10 - perms.len else 0); + print_padding(max_access_len - perms.len + 2); var size_buf: [32]u8 = undefined; const size_str = format_size(entry.size, &size_buf); - print_padding(if (size_str.len < 6) 6 - size_str.len else 0); _ = akiba.io.mark(akiba.io.stream, size_str, Color.green) catch 0; - print_padding(2); + print_padding(max_size_len - size_str.len + 2); _ = akiba.io.mark(akiba.io.stream, owner, Color.yellow) catch 0; - print_padding(max_owner_len - owner.len + 2); + print_padding(max_owner_len - owner.len + 3); format_date(entry.modified_time); + print_padding(1); if (entry.is_stack) { stack_count += 1; @@ -89,12 +103,12 @@ fn display_stack(path: []const u8) !void { if (count > 0) { _ = akiba.io.mark(akiba.io.stream, "\n", Color.white) catch 0; var buf: [16]u8 = undefined; - _ = akiba.io.mark(akiba.io.stream, int_to_str(stack_count, &buf), Color.white) catch 0; - _ = akiba.io.mark(akiba.io.stream, " stacks ", Color.white) catch 0; - _ = akiba.io.mark(akiba.io.stream, int_to_str(unit_count, &buf), Color.white) catch 0; - _ = akiba.io.mark(akiba.io.stream, " units ", Color.white) catch 0; + _ = akiba.io.mark(akiba.io.stream, int_to_str(stack_count, &buf), Color.gray) catch 0; + _ = akiba.io.mark(akiba.io.stream, " stacks ", Color.gray) catch 0; + _ = akiba.io.mark(akiba.io.stream, int_to_str(unit_count, &buf), Color.gray) catch 0; + _ = akiba.io.mark(akiba.io.stream, " units ", Color.gray) catch 0; var size_buf: [32]u8 = undefined; - _ = akiba.io.mark(akiba.io.stream, format_size(total_size, &size_buf), Color.white) catch 0; + _ = akiba.io.mark(akiba.io.stream, format_size(total_size, &size_buf), Color.gray) catch 0; _ = akiba.io.mark(akiba.io.stream, "\n\n", Color.white) catch 0; } } @@ -158,7 +172,7 @@ fn format_date(timestamp: u64) void { var buf: [20]u8 = undefined; var pos: usize = 0; if (day < 10) { - buf[pos] = ' '; + buf[pos] = '0'; pos += 1; } const day_str = int_to_str(day, buf[pos..]); diff --git a/mirai/ash/ash.zig b/mirai/ash/ash.zig index a5a4602..6f2e7ff 100644 --- a/mirai/ash/ash.zig +++ b/mirai/ash/ash.zig @@ -51,8 +51,7 @@ pub fn on_key_press(char: u8) void { } fn show_prompt() void { - const stack_name = get_current_stack_name(); - terminal.print(stack_name); + terminal.print(current_path[0..current_path_len]); terminal.print(" >>> "); } diff --git a/mirai/fs/afs.zig b/mirai/fs/afs.zig index 2ec3e26..f69703f 100644 --- a/mirai/fs/afs.zig +++ b/mirai/fs/afs.zig @@ -240,6 +240,7 @@ pub fn AFS(comptime BlockDeviceType: type) type { } entries[count].owner_name_len = entry.owner_name_len; entries[count].permission_type = entry.permission_type; + entries[count].modified_time = entry.modified_time; // Calculate recursive size for directories if (entry.entry_type == ENTRY_TYPE_DIR) { diff --git a/mirai/invocations/viewstack.zig b/mirai/invocations/viewstack.zig index ad5b2b4..c2a6d24 100644 --- a/mirai/invocations/viewstack.zig +++ b/mirai/invocations/viewstack.zig @@ -80,10 +80,10 @@ pub fn invoke(ctx: *handler.InvocationContext) void { const UserStackEntry = extern struct { identity: [64]u8, identity_len: u8, - size: u32, is_stack: bool, - modified_time: u64, - owner_name: [64]u8, owner_name_len: u8, permission_type: u8, + size: u32, + modified_time: u64, + owner_name: [64]u8, }; diff --git a/system/libraries/akiba/io.zig b/system/libraries/akiba/io.zig index 3560b6a..6dba329 100644 --- a/system/libraries/akiba/io.zig +++ b/system/libraries/akiba/io.zig @@ -87,10 +87,10 @@ pub fn viewstack(path: []const u8, entries: []StackEntry) Error!usize { pub const StackEntry = extern struct { identity: [64]u8, identity_len: u8, - size: u32, is_stack: bool, - modified_time: u64, - owner_name: [64]u8, owner_name_len: u8, permission_type: u8, + size: u32, + modified_time: u64, + owner_name: [64]u8, }; |
