Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/cli/cli_args.zig
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ pub const ExperimentalLspArgs = struct {
pub const ReplArgs = struct {
opt: OptLevel = .dev,
no_color: bool = false,
rpc: bool = false,
};

/// Arguments for `roc glue`
Expand Down Expand Up @@ -807,6 +808,7 @@ fn parseTest(args: []const []const u8) CliArgs {
fn parseRepl(args: []const []const u8) CliArgs {
var opt: OptLevel = .dev;
var no_color: bool = false;
var rpc: bool = false;

for (args) |arg| {
if (isHelpFlag(arg)) {
Expand All @@ -818,11 +820,14 @@ fn parseRepl(args: []const []const u8) CliArgs {
\\Options:
\\ --opt=<opt> Execution mode: dev (default, fast compilation), interpreter, size (LLVM) or speed (LLVM)
\\ --no-color Do not use ANSI color codes in REPL diagnostics
\\ --rpc Start in JSON-RPC server mode
\\ -h, --help Print help
\\
};
} else if (mem.eql(u8, arg, "--no-color")) {
no_color = true;
} else if (mem.eql(u8, arg, "--rpc")) {
rpc = true;
} else if (mem.startsWith(u8, arg, "--opt")) {
if (getFlagValue(arg)) |value| {
if (OptLevel.from_str(value)) |level| {
Expand All @@ -837,7 +842,7 @@ fn parseRepl(args: []const []const u8) CliArgs {
return CliArgs{ .problem = ArgProblem{ .unexpected_argument = .{ .cmd = "repl", .arg = arg } } };
}
}
return CliArgs{ .repl = .{ .opt = opt, .no_color = no_color } };
return CliArgs{ .repl = .{ .opt = opt, .no_color = no_color, .rpc = rpc } };
}

fn parseGlue(args: []const []const u8) CliArgs {
Expand Down
Loading