allow configuring shell integration injection

This commit is contained in:
Mitchell Hashimoto
2023-07-06 18:04:12 -07:00
parent 18e43ddb3f
commit 8239f09d9d
3 changed files with 46 additions and 4 deletions

View File

@@ -17,8 +17,13 @@ pub fn setup(
resource_dir: []const u8,
command_path: []const u8,
env: *EnvMap,
force_shell: ?Shell,
) !?Shell {
const exe = std.fs.path.basename(command_path);
const exe = if (force_shell) |shell| switch (shell) {
.fish => "/fish",
.zsh => "/zsh",
} else std.fs.path.basename(command_path);
if (std.mem.eql(u8, "fish", exe)) {
try setupFish(resource_dir, env);
return .fish;