summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-07-08 05:35:09 -0300
committerGabriel Schneider <[email protected]>2026-08-01 15:02:07 -0300
commit146944accb5852c548e25c7194b2865531e67cbb (patch)
tree532be12c0e5b4c8ff8bfafc6712f7011fd98784b /src/pardes.zig
parent2826704c7f829b5b5375ed2bf7414b455d3b0735 (diff)
downloadpardes-146944accb5852c548e25c7194b2865531e67cbb.tar.gz
pardes-146944accb5852c548e25c7194b2865531e67cbb.zip
argv positionals: bare pardes boots the shell pane in tty mode, a FILE arg (file:LINE works) opens it focused in the left column with a greeting terminal on the launch dir at right, a DIRECTORY arg chdirs so shells spawn there. New argv.snap; boot/restore.snap pin -n 1 to keep the classic boot.
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index 0219d474..fc216b24 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -670,6 +670,10 @@ pub const Options = struct {
tty_only: bool = false,
/// initial shell panes: 1 (default) or 3 for the classic two-column boot
shells: u8 = 1,
+ /// argv FILE (resolved absolute): boot with it focused as a doc pane in
+ /// the left column, a terminal on the launch directory in the right
+ file: ?[]const u8 = null,
+ file_line: usize = 0,
tty_toggle: u21 = 'b',
/// load a dump of another instance instead of spawning shells (acme -l)
load_path: ?[]const u8 = null,
@@ -749,7 +753,21 @@ pub const Pardes = struct {
syntax.compileStartupQueries();
const p = try gpa.create(Pardes);
p.* = .{ .gpa = gpa, .opts = opts, .screen_w = opts.cols, .screen_h = opts.rows, .scratch = .init(gpa) };
- if (opts.tty_only) {
+ if (opts.file) |path| {
+ // FILE argv boot: the doc focused in the left column, a terminal
+ // on the launch directory in the right (files left, shells right)
+ _ = if (look.isImagePath(path))
+ try p.openImageView(0, path, !p.kitty_ok)
+ else
+ try p.openFileView(0, path, opts.file_line);
+ const sh = try p.newPane(1);
+ sh.greet = true;
+ p.ncol = 2;
+ p.col_n[0] = 1;
+ p.col_terms[0][0] = 0;
+ p.col_n[1] = 1;
+ p.col_terms[1][0] = 1;
+ } else if (opts.tty_only) {
_ = try p.newPane(0);
p.panes[0].?.mode = .tty;
p.ncol = 1;