You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/config.rs
+36Lines changed: 36 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -189,6 +189,42 @@ impl Config {
189
189
Ok(config)
190
190
}
191
191
192
+
/// Diagnose why no packages were found and return a hint suitable for
193
+
/// printing to stderr. Returns `None` when at least one package path
194
+
/// exists on disk (i.e. there's no obvious config problem to surface).
195
+
pubfnfirst_run_hint(&self) -> Option<String>{
196
+
let config_path = Self::config_path();
197
+
if !config_path.exists(){
198
+
returnSome(format!(
199
+
"No anvil config found at {}.\n - Run `anvil init --config` to scaffold one\n - Or set ANVIL_PACKAGES to a colon-separated list of package directories",
200
+
config_path.display()
201
+
));
202
+
}
203
+
204
+
ifself.package_paths.is_empty(){
205
+
returnSome(format!(
206
+
"{} sets no `package_paths`.\n - Add e.g. `package_paths: [~/packages]` to point anvil at your packages\n - Or set ANVIL_PACKAGES",
207
+
config_path.display()
208
+
));
209
+
}
210
+
211
+
ifself.all_package_paths().is_empty(){
212
+
let listed = self
213
+
.package_paths
214
+
.iter()
215
+
.map(|p| format!(" - {}", p))
216
+
.collect::<Vec<_>>()
217
+
.join("\n");
218
+
returnSome(format!(
219
+
"None of the configured package_paths exist on disk:\n{}\n Create one of them, or edit {}.",
0 commit comments