diff --git a/cli/Cargo.toml b/cli/Cargo.toml index bf9b4de4c..96db2e855 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -18,6 +18,7 @@ include = [ "/build.rs", "/examples/", "/src/", + "/docs/**", "/testing/", "/tests/", "!*.pending-snap", diff --git a/cli/build.rs b/cli/build.rs index 993a0913e..034534545 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -37,6 +37,14 @@ fn main() { } else { println!("cargo:rustc-env=JJ_VERSION={version}"); } + + let docs_symlink_path = Path::new("docs"); + println!("cargo:rerun-if-changed={}", docs_symlink_path.display()); + if docs_symlink_path.join("index.md").exists() { + println!("cargo:rustc-env=JJ_DOCS_DIR=docs/"); + } else { + println!("cargo:rustc-env=JJ_DOCS_DIR=../docs/"); + } } fn get_git_hash() -> Option { diff --git a/cli/docs b/cli/docs new file mode 120000 index 000000000..a9594bfe4 --- /dev/null +++ b/cli/docs @@ -0,0 +1 @@ +../docs \ No newline at end of file diff --git a/cli/src/commands/help.rs b/cli/src/commands/help.rs index 0def340ed..feaeccd73 100644 --- a/cli/src/commands/help.rs +++ b/cli/src/commands/help.rs @@ -98,12 +98,12 @@ const KEYWORDS: &[Keyword] = &[ Keyword { name: "revsets", description: "A functional language for selecting a set of revision", - content: include_str!("../../../docs/revsets.md"), + content: include_str!(concat!("../../", env!("JJ_DOCS_DIR"), "revsets.md")), }, Keyword { name: "tutorial", description: "Show a tutorial to get started with jj", - content: include_str!("../../../docs/tutorial.md"), + content: include_str!(concat!("../../", env!("JJ_DOCS_DIR"), "tutorial.md")), }, ]; diff --git a/foo bar b/foo bar new file mode 100644 index 000000000..e69de29bb