mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-11-12 04:52:53 +01:00
mzteinit: add fixed emergency shell shortcut
This commit is contained in:
parent
072d4a6517
commit
339caf03de
1 changed files with 9 additions and 0 deletions
|
@ -209,6 +209,11 @@ fn ui(buf_writer: anytype, entries: []command.Command) !command.Command {
|
||||||
try updateStyle(w, .{ .foreground = .Green }, &style);
|
try updateStyle(w, .{ .foreground = .Green }, &style);
|
||||||
try w.print("{s}\n", .{entry.label});
|
try w.print("{s}\n", .{entry.label});
|
||||||
}
|
}
|
||||||
|
try updateStyle(w, .{
|
||||||
|
.foreground = .Red,
|
||||||
|
.font_style = .{ .bold = true },
|
||||||
|
}, &style);
|
||||||
|
try w.writeAll("\n[#] EMERGENCY SHELL\n");
|
||||||
try at.format.resetStyle(w);
|
try at.format.resetStyle(w);
|
||||||
style = .{};
|
style = .{};
|
||||||
|
|
||||||
|
@ -224,6 +229,10 @@ fn ui(buf_writer: anytype, entries: []command.Command) !command.Command {
|
||||||
var c: [1]u8 = undefined;
|
var c: [1]u8 = undefined;
|
||||||
while (cmd == null) {
|
while (cmd == null) {
|
||||||
std.debug.assert(try std.io.getStdIn().read(&c) == 1);
|
std.debug.assert(try std.io.getStdIn().read(&c) == 1);
|
||||||
|
if (c[0] == '#') {
|
||||||
|
return error.ManualEmergency;
|
||||||
|
}
|
||||||
|
|
||||||
const key_upper = std.ascii.toUpper(c[0]);
|
const key_upper = std.ascii.toUpper(c[0]);
|
||||||
for (entries) |entry| {
|
for (entries) |entry| {
|
||||||
if (entry.key == key_upper) {
|
if (entry.key == key_upper) {
|
||||||
|
|
Loading…
Reference in a new issue