Skip to content

Commit 42c407d

Browse files
feat: improve error reporting for sgconfig not found
Changed error reporting for sgconfig not found
1 parent 55f2776 commit 42c407d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

crates/cli/src/utils/error_context.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const DOC_SITE_HOST: &str = "https://ast-grep.github.io";
88
const PATTERN_GUIDE: Option<&str> = Some("/guide/pattern-syntax.html");
99
const CONFIG_GUIDE: Option<&str> = Some("/guide/rule-config.html");
1010
const CONFIG_REFERENCE: Option<&str> = Some("/reference/sgconfig.html");
11+
const PROJECT_GUIDE: Option<&str> = Some("/guide/scan-project.html");
1112
const TOOL_OVERVIEW: Option<&str> = Some("/guide/tooling-overview.html#parse-code-from-stdin");
1213
const CLI_USAGE: Option<&str> = Some("/reference/cli.html");
1314
const TEST_GUIDE: Option<&str> = Some("/guide/test-rule.html");
@@ -233,12 +234,12 @@ impl ErrorMessage {
233234
ProjectAlreadyExist => Self::new(
234235
"ast-grep project already exists.",
235236
"You are already inside a sub-folder of an ast-grep project. Try finding sgconfig.yml in ancestor directory?",
236-
CONFIG_GUIDE,
237+
PROJECT_GUIDE,
237238
),
238239
ProjectNotExist => Self::new(
239-
"Fail to create the item because no project configuration is found.",
240-
"You need to create an ast-grep project before creating rule. Try `sg new` to create one.",
241-
CONFIG_GUIDE,
240+
"No ast-grep project configuration is found.",
241+
"You need to create an ast-grep project for this command. Try `sg new` to create one.",
242+
PROJECT_GUIDE,
242243
),
243244
FileAlreadyExist(path) => Self::new(
244245
format!("File `{}` already exists.", path.display()),

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy