-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.zig
More file actions
83 lines (81 loc) · 3.29 KB
/
cli.zig
File metadata and controls
83 lines (81 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
const std = @import("std");
const Allocator = std.mem.Allocator;
const streql = @import("common").streql;
const Version = @import("main.zig").Version;
const utils = @import("utils.zig");
const cova = @import("cova");
pub const CommandT = cova.Command.Base();
pub const OptionT = CommandT.OptionT;
pub const ValueT = CommandT.ValueT;
pub const Cli = CommandT{
.name = "zigverm",
.description = "A version manager for the Zig programming language",
.sub_cmds = &.{
.{
.name = "install",
.description = "Install a specific version",
.vals = &.{
ValueT.ofType([]const u8, .{ .name = "version", .description = "Version can be any valid semantic version or master or stable" }),
},
},
.{
.name = "remove",
.description = "Remove a already installed specific version.",
.vals = &.{
ValueT.ofType([]const u8, .{ .name = "version", .description = "Version can be any valid semantic version or master or stable" }),
},
},
.{
.name = "override",
.description = "Override the version of zig used",
.opts = &.{OptionT{
.name = "directory",
.short_name = 'd',
.long_name = "dir",
.description =
\\ DIRECTORY can be
\\ - Path to a directory, under which to override
\\ - "default", to change the default version
\\ - ommited to use the current directory
,
.val = ValueT.ofType([]const u8, .{
.name = "directory",
}),
}},
.vals = &.{
ValueT.ofType([]const u8, .{ .name = "version", .description = "Version can be any valid semantic version or master or stable" }),
},
},
.{
.name = "override-rm",
.description = "Override the version of zig used",
.vals = &.{
ValueT.ofType([]const u8, .{ .name = "directory", .description = "DIRECTORY should be path to a directory, for which to remove override" }),
},
},
.{
.name = "std",
.description = "Open the standard library documentation in the default web browser.",
.vals = &.{
ValueT.ofType([]const u8, .{ .name = "version", .description = "Opens for this VERSION. If not specified, opens for the active Zig version in the current directory.", .default_val = "" }),
},
.vals_mandatory = false,
},
.{
.name = "reference",
.description = "Open the language reference in the default web browser.",
.vals = &.{
ValueT.ofType([]const u8, .{ .name = "version", .description = "Opens for this VERSION. If not specified, opens for the active version on the current directory.", .default_val = "" }),
},
.vals_mandatory = false,
},
.{
.name = "info",
.description = "Show information about installations",
},
.{
.name = "update-self",
.description = "Update zigverm itself",
},
},
};