Просмотр исходного кода

Add things that quickdoc supports

This quickdoc: https://github.com/heyLu/quickdoc/blob/master/quickdoc.go
Luna Stadler лет назад: 4
Родитель
Сommit
c3f2b566b4
1 измененных файлов с 7 добавлено и 1 удалено
  1. 7 1
      zig/sdl/hello_sdl.zig

+ 7 - 1
zig/sdl/hello_sdl.zig

@ -158,7 +158,13 @@ fn runCommand(raw_cmd: []const u8, allocator: *std.mem.Allocator) !?[*:0]u8 {
158 158
    const argv = if (std.mem.startsWith(u8, cmd, "go "))
159 159
        &[_][]const u8{ "go", "doc", cmd[3..] }
160 160
    else if (std.mem.startsWith(u8, cmd, "py "))
161
        &[_][]const u8{ "python", "-c", try std.fmt.allocPrint(allocator, "import {s}; help({s});", .{ cmd["py ".len..], cmd["py ".len..] }) }
161
        &[_][]const u8{ "python", "-c", try std.fmt.allocPrint(allocator, "import {s}; help({s});", .{ std.mem.sliceTo(cmd["py ".len..], '.'), cmd["py ".len..] }) }
162
    else if (std.mem.endsWith(u8, cmd, " --help"))
163
        // TODO: handle --help that outputs on stderr
164
        &[_][]const u8{ cmd[0..(cmd.len - " --help".len)], "--help" }
165
    else if (std.mem.startsWith(u8, cmd, "man "))
166
        // TODO: handle `man 5 sway`
167
        &[_][]const u8{ "man", cmd["man ".len..] }
162 168
    else
163 169
        &[_][]const u8{ "/usr/bin/qalc", "-terse", cmd };
164 170
    for (argv) |arg| {