diff --git a/docs/mdsource/plugin_repom.plugin.azuredevops.generated.source.md b/docs/mdsource/plugin_repom.plugin.azuredevops.generated.source.md index c59831f3..8f05676c 100644 --- a/docs/mdsource/plugin_repom.plugin.azuredevops.generated.source.md +++ b/docs/mdsource/plugin_repom.plugin.azuredevops.generated.source.md @@ -43,11 +43,14 @@ Title will be the last part of the branchname split on `/`, so `feature/123-test - `to-branch`: Name of the branch the pull request should be merged into. For instance `develop`, or `main`. ([Text](repository_action_types.md#text)) - `reviewer-ids`: List of reviewer ids. The id should be a valid Azure DevOps user id (i.e. GUID). (List) - `draft-pr`: Boolean specifying if th PR should be marked as draft. ([Predicate](repository_action_types.md#predicate)) -- `include-work-items`: Boolean specifying if workitems should be included in the PR. RepoM will try to resolve the workitems by looping through the commit messages. ([Predicate](repository_action_types.md#predicate)) +- `include-work-items`: Boolean specifying if work items should be included in the PR. RepoM will try to resolve the work items by looping through the commit messages. ([Predicate](repository_action_types.md#predicate)) - `open-in-browser`: Boolean specifying if the Pull request should be opened in the browser after creation. ([Predicate](repository_action_types.md#predicate)) - `context`: The context in which the action is available. ([Context](repository_action_types.md#context)) - `active`: Whether the menu item is enabled. ([Predicate](repository_action_types.md#predicate)) -- `auto-complete`: Auto complete options. Please take a look at the same for more information (AutoCompleteOptionsV1, optional) +- `auto-complete`: Auto complete options. + - `merge-strategy`: The merge strategy. Possible values are `no-fast-forward`, `squash`, `rebase`, and `rebase-merge`. + - `delete-source-branch`: Boolean specifying if the source branch should be deleted after completion. ([Predicate](repository_action_types.md#predicate) + - `transition-work-items`: Boolean specifying if related work items should be transitioned to the next state. ([Predicate](repository_action_types.md#predicate) ### Example diff --git a/src/RepoM.ActionMenu.CodeGen/Models/MemberDescriptor.cs b/src/RepoM.ActionMenu.CodeGen/Models/MemberDescriptor.cs index 00b9528d..1eed1e1c 100644 --- a/src/RepoM.ActionMenu.CodeGen/Models/MemberDescriptor.cs +++ b/src/RepoM.ActionMenu.CodeGen/Models/MemberDescriptor.cs @@ -28,9 +28,10 @@ public TypeInfoDescriptor(ITypeSymbol typeSymbol) { Nullable = IsNullableType(typeSymbol); + // hack if (Name.Contains("AutoCompleteOptionsV1")) { - // do nothing intentionally, just for debugging coenm + SkipForDocumentGeneration = true; } } @@ -65,6 +66,11 @@ public TypeInfoDescriptor(string name, string csharpTypeName) public bool Nullable { get; set; } + /// + /// Skip this type for document generation. + /// + public bool SkipForDocumentGeneration { get; set; } = false; + private static bool IsNullableType(ITypeSymbol typeSymbol) { return typeSymbol is INamedTypeSymbol { NullableAnnotation: NullableAnnotation.Annotated, }; diff --git a/src/RepoM.ActionMenu.CodeGen/Templates/DocsPlugin.scriban-txt b/src/RepoM.ActionMenu.CodeGen/Templates/DocsPlugin.scriban-txt index 2e34680a..c87cbac4 100644 --- a/src/RepoM.ActionMenu.CodeGen/Templates/DocsPlugin.scriban-txt +++ b/src/RepoM.ActionMenu.CodeGen/Templates/DocsPlugin.scriban-txt @@ -1,5 +1,16 @@ {{~ +func write_parenthesis_when_not_empty(s) + if !string.empty s + ret "(" + s + ")" + end + ret "" +end + func write_type_with_link(t) + if t.SkipForDocumentGeneration + ret ""; + end + result = t.Name; if !string.empty t.Link diff --git a/src/RepoM.ActionMenu.CodeGen/Templates/Parts/actionmenu.scriban-txt b/src/RepoM.ActionMenu.CodeGen/Templates/Parts/actionmenu.scriban-txt index 1352165a..78bfd1fd 100644 --- a/src/RepoM.ActionMenu.CodeGen/Templates/Parts/actionmenu.scriban-txt +++ b/src/RepoM.ActionMenu.CodeGen/Templates/Parts/actionmenu.scriban-txt @@ -5,7 +5,12 @@ Properties: {{~ for p in actionmenu_item.ActionMenuProperties ~}} -- `{{ hyphenated p.CSharpName }}`: {{ p.Description }} ({{ write_type_with_link p.ReturnType }}) +- `{{ hyphenated p.CSharpName }}`: {{ p.Description }} {{ write_parenthesis_when_not_empty (write_type_with_link (p.ReturnType)) }} +{{~ if hyphenated(p.CSharpName) == 'auto-complete' ~}} + - `merge-strategy`: The merge strategy. Possible values are `no-fast-forward`, `squash`, `rebase`, and `rebase-merge`. + - `delete-source-branch`: Boolean specifying if the source branch should be deleted after completion. ([Predicate](repository_action_types.md#predicate) + - `transition-work-items`: Boolean specifying if related work items should be transitioned to the next state. ([Predicate](repository_action_types.md#predicate) +{{~ end ~}} {{~ end ~}} {{~ if actionmenu_item.Examples ~}} @@ -36,7 +41,7 @@ Properties: {{ example_item.Text }} {{~ else ~}} - NAME NOT FOUND!! {{ example_item.TypeName }}. + NAME NOT FOUND!! {{ example_item.TypeName }}. {{~ end ~}} {{~ end ~}} {{~ end ~}} \ No newline at end of file diff --git a/src/RepoM.Plugin.AzureDevOps/ActionMenu/Model/ActionMenus/CreatePullRequest/AutoCompleteOptionsV1.cs b/src/RepoM.Plugin.AzureDevOps/ActionMenu/Model/ActionMenus/CreatePullRequest/AutoCompleteOptionsV1.cs index 77ccc140..cf7d5b8a 100644 --- a/src/RepoM.Plugin.AzureDevOps/ActionMenu/Model/ActionMenus/CreatePullRequest/AutoCompleteOptionsV1.cs +++ b/src/RepoM.Plugin.AzureDevOps/ActionMenu/Model/ActionMenus/CreatePullRequest/AutoCompleteOptionsV1.cs @@ -20,14 +20,14 @@ internal class AutoCompleteOptionsV1 public MergeStrategyV1 MergeStrategy { get; set; } = MergeStrategyV1.NoFastForward; // GitHub issue: https://github.com/coenm/RepoM/issues/87 /// - /// Boolean specifying if the source branche should be deleted afer completion. + /// Boolean specifying if the source branch should be deleted after completion. /// [Required] [Predicate(true)] public Predicate DeleteSourceBranch { get; set; } = true; /// - /// Boolean specifying if related workitems should be transitioned to the next state. + /// Boolean specifying if related work items should be transitioned to the next state. /// [Required] [Predicate(true)] diff --git a/src/RepoM.Plugin.AzureDevOps/ActionMenu/Model/ActionMenus/CreatePullRequest/RepositoryActionAzureDevOpsCreatePullRequestV1.cs b/src/RepoM.Plugin.AzureDevOps/ActionMenu/Model/ActionMenus/CreatePullRequest/RepositoryActionAzureDevOpsCreatePullRequestV1.cs index 58851371..89d898de 100644 --- a/src/RepoM.Plugin.AzureDevOps/ActionMenu/Model/ActionMenus/CreatePullRequest/RepositoryActionAzureDevOpsCreatePullRequestV1.cs +++ b/src/RepoM.Plugin.AzureDevOps/ActionMenu/Model/ActionMenus/CreatePullRequest/RepositoryActionAzureDevOpsCreatePullRequestV1.cs @@ -69,7 +69,7 @@ public string Type public Predicate DraftPr { get; set; } = false; /// - /// Boolean specifying if workitems should be included in the PR. RepoM will try to resolve the workitems by looping through the commit messages. + /// Boolean specifying if work items should be included in the PR. RepoM will try to resolve the work items by looping through the commit messages. /// [Predicate(true)] public Predicate IncludeWorkItems { get; set; } = true; @@ -88,7 +88,7 @@ public string Type public Predicate Active { get; set; } = true; /// - /// Auto complete options. Please take a look at the same for more information + /// Auto complete options. /// public AutoCompleteOptionsV1? AutoComplete { get; set; } diff --git a/tests/RepoM.ActionMenu.CodeGen.Tests/ProgramTests.CompileAndExtractProjectDescription_ShouldReturn_WhenValidProject.verified.txt b/tests/RepoM.ActionMenu.CodeGen.Tests/ProgramTests.CompileAndExtractProjectDescription_ShouldReturn_WhenValidProject.verified.txt index 575ed33e..12f95b63 100644 --- a/tests/RepoM.ActionMenu.CodeGen.Tests/ProgramTests.CompileAndExtractProjectDescription_ShouldReturn_WhenValidProject.verified.txt +++ b/tests/RepoM.ActionMenu.CodeGen.Tests/ProgramTests.CompileAndExtractProjectDescription_ShouldReturn_WhenValidProject.verified.txt @@ -66,7 +66,7 @@ This property will be used instead of the Name property. IsConst: false, Description: Pull Request title. When not provided, the title will be defined based on the branch name. -Title will be the last part of the branchname split on `/`, so `feature/123-testBranch` will result in title `123-testBranch`, +Title will be the last part of the branch name split on `/`, so `feature/123-testBranch` will result in title `123-testBranch`, Examples: { Items: [ { diff --git a/tests/RepoM.ActionMenu.CodeGenDummyLibrary/ActionMenu/Model/ActionMenus/RepositoryActionDummyAbcV1.cs b/tests/RepoM.ActionMenu.CodeGenDummyLibrary/ActionMenu/Model/ActionMenus/RepositoryActionDummyAbcV1.cs index 294646c4..110acf24 100644 --- a/tests/RepoM.ActionMenu.CodeGenDummyLibrary/ActionMenu/Model/ActionMenus/RepositoryActionDummyAbcV1.cs +++ b/tests/RepoM.ActionMenu.CodeGenDummyLibrary/ActionMenu/Model/ActionMenus/RepositoryActionDummyAbcV1.cs @@ -48,7 +48,7 @@ public string Type /// /// Pull Request title. When not provided, the title will be defined based on the branch name. - /// Title will be the last part of the branchname split on `/`, so `feature/123-testBranch` will result in title `123-testBranch` + /// Title will be the last part of the branch name split on `/`, so `feature/123-testBranch` will result in title `123-testBranch` /// /// /// `{{ repository.branch | string.replace "feature/" "" | string.truncate 16 "..." }}`