feat: add cli option to open the input view on start
This commit is contained in:
parent
61610f579a
commit
21bac1ab0c
2 changed files with 8 additions and 0 deletions
|
@ -24,6 +24,7 @@ pub fn main() anyerror!void {
|
|||
\\--no-alternate Do not use the alternate terminal screen.
|
||||
\\--no-trace Do not enable internal tracing.
|
||||
\\--restore-session Restore restart session.
|
||||
\\--show-input Open the input view on start.
|
||||
\\<str>... File to open.
|
||||
\\ Add +<LINE> to the command line or append
|
||||
\\ :LINE or :LINE:COL to the file name to jump
|
||||
|
@ -82,6 +83,7 @@ pub fn main() anyerror!void {
|
|||
|
||||
env.set("restore-session", (res.args.@"restore-session" != 0));
|
||||
env.set("no-alternate", (res.args.@"no-alternate" != 0));
|
||||
env.set("show-input", (res.args.@"show-input" != 0));
|
||||
env.set("no-sleep", (res.args.@"no-sleep" != 0));
|
||||
env.set("dump-stack-trace", (res.args.@"debug-dump-on-error" != 0));
|
||||
if (res.args.@"frame-rate") |frame_rate|
|
||||
|
|
|
@ -57,6 +57,8 @@ pub fn create(a: std.mem.Allocator, n: nc.Plane) !Widget {
|
|||
try widgets.add(try Widget.empty(a, n, .dynamic));
|
||||
self.statusbar = try widgets.addP(try @import("status/statusbar.zig").create(a, w));
|
||||
self.resize();
|
||||
if (tp.env.get().is("show-input"))
|
||||
self.toggle_inputview_async();
|
||||
return w;
|
||||
}
|
||||
|
||||
|
@ -335,6 +337,10 @@ fn create_editor(self: *Self) tp.result {
|
|||
self.resize();
|
||||
}
|
||||
|
||||
fn toggle_inputview_async(_: *Self) void {
|
||||
tp.self_pid().send(.{ "cmd", "toggle_inputview" }) catch return;
|
||||
}
|
||||
|
||||
fn show_home_async(_: *Self) void {
|
||||
tp.self_pid().send(.{ "cmd", "show_home" }) catch return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue