diff --git a/cli/src/commands/help.rs b/cli/src/commands/help.rs index feaeccd736..408e633ab7 100644 --- a/cli/src/commands/help.rs +++ b/cli/src/commands/help.rs @@ -95,11 +95,36 @@ struct Keyword { // // Maybe we can steal some ideas from https://github.com/martinvonz/jj/pull/3130 const KEYWORDS: &[Keyword] = &[ + Keyword { + name: "bookmarks", + description: "Named pointers to revisions (similar to Git's branches)", + content: include_str!(concat!("../../", env!("JJ_DOCS_DIR"), "bookmarks.md")), + }, + Keyword { + name: "config", + description: "How and where to set configuration options", + content: include_str!(concat!("../../", env!("JJ_DOCS_DIR"), "config.md")), + }, + Keyword { + name: "filesets", + description: "A functional language for selecting a set of files", + content: include_str!(concat!("../../", env!("JJ_DOCS_DIR"), "filesets.md")), + }, + Keyword { + name: "glossary", + description: "Definitions of various terms", + content: include_str!(concat!("../../", env!("JJ_DOCS_DIR"), "glossary.md")), + }, Keyword { name: "revsets", description: "A functional language for selecting a set of revision", content: include_str!(concat!("../../", env!("JJ_DOCS_DIR"), "revsets.md")), }, + Keyword { + name: "templates", + description: "A functional language to customize command output", + content: include_str!(concat!("../../", env!("JJ_DOCS_DIR"), "templates.md")), + }, Keyword { name: "tutorial", description: "Show a tutorial to get started with jj", diff --git a/cli/tests/cli-reference@.md.snap b/cli/tests/cli-reference@.md.snap index e38c4a5545..80df301245 100644 --- a/cli/tests/cli-reference@.md.snap +++ b/cli/tests/cli-reference@.md.snap @@ -1,7 +1,6 @@ --- source: cli/tests/test_generate_md_cli_help.rs description: "AUTO-GENERATED FILE, DO NOT EDIT. This cli reference is generated by a test as an `insta` snapshot. MkDocs includes this snapshot from docs/cli-reference.md." -snapshot_kind: text --- @@ -1278,8 +1277,18 @@ Print this message or the help of the given subcommand(s) * `-k`, `--keyword ` — Show help for keywords instead of commands Possible values: + - `bookmarks`: + Named pointers to revisions (similar to Git's branches) + - `config`: + How and where to set configuration options + - `filesets`: + A functional language for selecting a set of files + - `glossary`: + Definitions of various terms - `revsets`: A functional language for selecting a set of revision + - `templates`: + A functional language to customize command output - `tutorial`: Show a tutorial to get started with jj diff --git a/cli/tests/test_help_command.rs b/cli/tests/test_help_command.rs index c1ee333dd7..8c540869b0 100644 --- a/cli/tests/test_help_command.rs +++ b/cli/tests/test_help_command.rs @@ -102,33 +102,33 @@ fn test_help_keyword() { // It should give hints if a similar keyword is present let help_cmd_stderr = test_env.jj_cmd_cli_error(test_env.env_root(), &["help", "-k", "rev"]); - insta::assert_snapshot!(help_cmd_stderr, @r#" + insta::assert_snapshot!(help_cmd_stderr, @r###" error: invalid value 'rev' for '--keyword ' - [possible values: revsets, tutorial] + [possible values: bookmarks, config, filesets, glossary, revsets, templates, tutorial] tip: a similar value exists: 'revsets' For more information, try '--help'. - "#); + "###); // It should give error with a hint if no similar keyword is found let help_cmd_stderr = test_env.jj_cmd_cli_error(test_env.env_root(), &["help", "-k", ""]); - insta::assert_snapshot!(help_cmd_stderr, @r#" + insta::assert_snapshot!(help_cmd_stderr, @r###" error: invalid value '' for '--keyword ' - [possible values: revsets, tutorial] + [possible values: bookmarks, config, filesets, glossary, revsets, templates, tutorial] For more information, try '--help'. - "#); + "###); // The keyword flag with no argument should error with a hint let help_cmd_stderr = test_env.jj_cmd_cli_error(test_env.env_root(), &["help", "-k"]); - insta::assert_snapshot!(help_cmd_stderr, @r#" + insta::assert_snapshot!(help_cmd_stderr, @r###" error: a value is required for '--keyword ' but none was supplied - [possible values: revsets, tutorial] + [possible values: bookmarks, config, filesets, glossary, revsets, templates, tutorial] For more information, try '--help'. - "#); + "###); // It shouldn't show help for a certain keyword if the `--keyword` is not // present