Merge pull request #3592 from rtfeldman/main-dot-roc

Advise using `roc run` with no arg if running `main.roc`
This commit is contained in:
Folkert de Vries 2022-07-21 18:36:39 +02:00 committed by GitHub
commit a432874290
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 18 deletions

View file

@ -715,8 +715,8 @@ pub fn build(
std::mem::forget(bytes);
x
} else {
println!(
"\x1B[{}m{}\x1B[39m {} and \x1B[{}m{}\x1B[39m {} found in {} ms.\n\nYou can run the program anyway with: \x1B[32mroc run {}\x1B[39m",
let mut output = format!(
"\x1B[{}m{}\x1B[39m {} and \x1B[{}m{}\x1B[39m {} found in {} ms.\n\nYou can run the program anyway with \x1B[32mroc run",
if problems.errors == 0 {
32 // green
} else {
@ -740,8 +740,15 @@ pub fn build(
"warnings"
},
total_time.as_millis(),
filename.to_string_lossy()
);
// If you're running "main.roc" then you can just do `roc run`
// to re-run the program.
if filename != DEFAULT_ROC_FILENAME {
output.push(' ');
output.push_str(&filename.to_string_lossy());
}
println!("{}\x1B[39m", output);
Ok(problems.exit_code())
}

View file

@ -5426,11 +5426,10 @@ fn to_missing_platform_report(module_id: ModuleId, other: PlatformPath) -> Strin
}
RootIsInterface => {
let doc = alloc.stack([
alloc.reflow(r"The input file is an interface module, but only app modules can be run."),
alloc.concat([
alloc.reflow(r"I will still parse and typecheck the input file and its dependencies, "),
alloc.reflow(r"but won't output any executable."),
])
alloc.reflow(
r"The input file is an `interface` module, but only `app` modules can be run.",
),
alloc.reflow(r"Tip: You can use `roc check` or `roc test` to verify an interface module like this one."),
]);
Report {
@ -5442,11 +5441,10 @@ fn to_missing_platform_report(module_id: ModuleId, other: PlatformPath) -> Strin
}
RootIsHosted => {
let doc = alloc.stack([
alloc.reflow(r"The input file is a hosted module, but only app modules can be run."),
alloc.concat([
alloc.reflow(r"I will still parse and typecheck the input file and its dependencies, "),
alloc.reflow(r"but won't output any executable."),
])
alloc.reflow(
r"The input file is a `hosted` module, but only `app` modules can be run.",
),
alloc.reflow(r"Tip: You can use `roc check` or `roc test` to verify a hosted module like this one."),
]);
Report {
@ -5458,11 +5456,10 @@ fn to_missing_platform_report(module_id: ModuleId, other: PlatformPath) -> Strin
}
RootIsPlatformModule => {
let doc = alloc.stack([
alloc.reflow(r"The input file is a package config file, but only app modules can be run."),
alloc.concat([
alloc.reflow(r"I will still parse and typecheck the input file and its dependencies, "),
alloc.reflow(r"but won't output any executable."),
])
alloc.reflow(
r"The input file is a `platform` module, but only `app` modules can be run.",
),
alloc.reflow(r"Tip: You can use `roc check` or `roc test` to verify a platform module like this one."),
]);
Report {