diff options
| author | 2022-04-26 00:44:24 +0300 | |
|---|---|---|
| committer | 2022-04-26 00:44:24 +0300 | |
| commit | 595477339b9e7dd696aaa31e21308f48c5a6109d (patch) | |
| tree | 96dca0017a60c40dd5437645cb11d8ff92318baf /src/remove.zig | |
| parent | Add a missing const (diff) | |
| download | zup-595477339b9e7dd696aaa31e21308f48c5a6109d.tar.gz zup-595477339b9e7dd696aaa31e21308f48c5a6109d.tar.xz zup-595477339b9e7dd696aaa31e21308f48c5a6109d.zip | |
Add Installation.isActive, use it
Diffstat (limited to 'src/remove.zig')
| -rw-r--r-- | src/remove.zig | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/remove.zig b/src/remove.zig index c1c35d4..ad1a610 100644 --- a/src/remove.zig +++ b/src/remove.zig | |||
| @@ -21,12 +21,7 @@ pub fn main(comptime Result: type, allocator: Allocator, res: Result) !void { | |||
| 21 | return error.InstallationNotFound; | 21 | return error.InstallationNotFound; |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | const is_active = blk: { | 24 | const is_active = try Installation.isActive(allocator, name); |
| 25 | const active = try Installation.getActiveName(allocator); | ||
| 26 | defer if (active) |s| allocator.free(s); | ||
| 27 | |||
| 28 | break :blk active != null and std.mem.eql(u8, active.?, name); | ||
| 29 | }; | ||
| 30 | 25 | ||
| 31 | if (is_active and !res.args.force) { | 26 | if (is_active and !res.args.force) { |
| 32 | std.log.err("{s} is the active installation, not removing without --force!", .{name}); | 27 | std.log.err("{s} is the active installation, not removing without --force!", .{name}); |