Skip to content

Commit 5fe2cab

Browse files
author
StunxFS
committed
refact(cmd): rename new module to tools
1 parent 276afc7 commit 5fe2cab

File tree

5 files changed

+23
-4
lines changed

5 files changed

+23
-4
lines changed

cmd/src/main.ri

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import std/process;
88
import rivet;
99
import rivet/utils;
1010

11-
import ./new;
11+
import ./tools;
1212

1313
func main() {
1414
if process.args.len == 1 {
@@ -17,7 +17,7 @@ func main() {
1717
}
1818
cmd := process.args[1];
1919
switch cmd {
20-
"new", "init" => new.new(process.args[2..], cmd == "init")!,
20+
"new", "init" => tools.new(process.args[2..], cmd == "init")!,
2121
"build", "run", "test", "check" => {
2222
is_test := cmd == "test";
2323
is_check := cmd == "check";
File renamed without changes.
File renamed without changes.

lib/std/src/sys/arch.ri

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
// Use of this source code is governed by an MIT license that can
33
// be found in the LICENSE file.
44

5+
import ../traits;
56
#if !(_X86_ or _AMD64_)
67
import ../process;
78
#endif
89

9-
public enum Arch as uint8 {
10+
public enum Arch as uint8 < traits.Stringable {
1011
X86,
1112
Amd64;
1213

@@ -18,6 +19,14 @@ public enum Arch as uint8 {
1819
else => none
1920
};
2021
}
22+
23+
public func to_string(&self) -> string {
24+
return switch self.* {
25+
.X86 => "x86",
26+
.Amd64 => "amd64",
27+
else => "unknown architecture"
28+
};
29+
}
2130
}
2231

2332
/// Returns the current architecture.

lib/std/src/sys/os.ri

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
// Use of this source code is governed by an MIT license that can
33
// be found in the LICENSE file.
44

5+
import ../traits;
56
#if !(_X86_ or _AMD64_)
67
import ../process;
78
#endif
89

9-
public enum OS as uint8 {
10+
public enum OS as uint8 < traits.Stringable {
1011
Linux,
1112
Windows,
1213
Macos;
@@ -20,6 +21,15 @@ public enum OS as uint8 {
2021
else => none
2122
};
2223
}
24+
25+
public func to_string(&self) -> string {
26+
return switch self.* {
27+
.Linux => "linux",
28+
.Windows => "windows",
29+
.Macos => "macos",
30+
else => "unknown operating system"
31+
};
32+
}
2333
}
2434

2535
/// Returns the current operating system.

0 commit comments

Comments
 (0)