feat(project): add close_project command bound to del in recent projects list

This commit is contained in:
CJ van den Berg 2025-02-09 20:39:32 +01:00
parent 90192ddf3c
commit 88ca1cd343
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
3 changed files with 46 additions and 0 deletions

View file

@ -274,6 +274,21 @@ const cmds = struct {
}
pub const open_project_dir_meta = .{ .arguments = &.{.string} };
pub fn close_project(_: *Self, ctx: Ctx) Result {
var project_dir: []const u8 = undefined;
if (!try ctx.args.match(.{tp.extract(&project_dir)}))
return;
project_manager.close(project_dir) catch |e| switch (e) {
error.CloseCurrentProject => {
const logger = log.logger("project");
defer logger.deinit();
logger.print_err("project", "cannot close current project", .{});
},
else => return e,
};
}
pub const close_project_meta: Meta = .{ .arguments = &.{.string} };
pub fn change_project(self: *Self, ctx: Ctx) Result {
var project_dir: []const u8 = undefined;
if (!try ctx.args.match(.{tp.extract(&project_dir)}))