Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion powershell/resources/assets/build-module.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ if($NoDocs) {
$null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue
}
$null = New-Item -ItemType Directory -Force -Path $docsFolder
Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ModuleDescription $moduleDescription -DocsFolder $docsFolder -ExamplesFolder $examplesFolder -ModuleGuid $guid
$addComplexInterfaceInfo = ![System.Convert]::ToBoolean('${$project.azure}')
Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ModuleDescription $moduleDescription -DocsFolder $docsFolder -ExamplesFolder $examplesFolder -ModuleGuid $guid -AddComplexInterfaceInfo:$addComplexInterfaceInfo
}

Write-Host -ForegroundColor Green 'Creating format.ps1xml...'
Expand Down
4 changes: 2 additions & 2 deletions powershell/resources/assets/generate-help.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ foreach($directory in $directories)
$docsPath = Join-Path $docsFolder $directory.Name
$null = New-Item -ItemType Directory -Force -Path $docsPath -ErrorAction SilentlyContinue
$examplesPath = Join-Path $examplesFolder $directory.Name

Export-HelpMarkdown -ModuleInfo $moduleInfo -FunctionInfo $cmdletFunctionInfo -HelpInfo $cmdletHelpInfo -DocsFolder $docsPath -ExamplesFolder $examplesPath
$addComplexInterfaceInfo = ![System.Convert]::ToBoolean('${$project.azure}')
Export-HelpMarkdown -ModuleInfo $moduleInfo -FunctionInfo $cmdletFunctionInfo -HelpInfo $cmdletHelpInfo -DocsFolder $docsPath -ExamplesFolder $examplesPath -AddComplexInterfaceInfo:$addComplexInterfaceInfo
Write-Host -ForegroundColor Green "Created documentation in '$docsPath'"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public class ExportHelpMarkdown : PSCmdlet
[ValidateNotNullOrEmpty]
public string ExamplesFolder { get; set; }

[Parameter()]
public SwitchParameter AddComplexInterfaceInfo { get; set; }

protected override void ProcessRecord()
{
try
Expand All @@ -41,7 +44,7 @@ protected override void ProcessRecord()
var variantGroups = FunctionInfo.Select(fi => fi.BaseObject).Cast<FunctionInfo>()
.Join(helpInfos, fi => fi.Name, phi => phi.CmdletName, (fi, phi) => fi.ToVariants(phi))
.Select(va => new VariantGroup(ModuleInfo.Name, va.First().CmdletName, va, String.Empty));
WriteMarkdowns(variantGroups, ModuleInfo.ToModuleInfo(), DocsFolder, ExamplesFolder);
WriteMarkdowns(variantGroups, ModuleInfo.ToModuleInfo(), DocsFolder, ExamplesFolder, AddComplexInterfaceInfo.IsPresent);
}
catch (Exception ee)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ public class ExportProxyCmdlet : PSCmdlet
[Parameter(Mandatory = true, ParameterSetName = "NoDocs")]
public SwitchParameter ExcludeDocs { get; set; }

[Parameter(ParameterSetName = "Docs")]
public SwitchParameter AddComplexInterfaceInfo { get; set; }

protected override void ProcessRecord()
{
try
Expand Down Expand Up @@ -152,7 +155,7 @@ protected override void ProcessRecord()
var isValidProfile = !String.IsNullOrEmpty(profileName) && profileName != NoProfiles;
var docsFolder = isValidProfile ? Path.Combine(DocsFolder, profileName) : DocsFolder;
var examplesFolder = isValidProfile ? Path.Combine(ExamplesFolder, profileName) : ExamplesFolder;
WriteMarkdowns(variantGroupsByProfile, moduleInfo, docsFolder, examplesFolder);
WriteMarkdowns(variantGroupsByProfile, moduleInfo, docsFolder, examplesFolder, AddComplexInterfaceInfo.IsPresent);
}
}
}
Expand Down
24 changes: 16 additions & 8 deletions powershell/resources/psruntime/BuildTime/MarkdownRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
{
internal static class MarkdownRenderer
{
public static void WriteMarkdowns(IEnumerable<VariantGroup> variantGroups, PsModuleHelpInfo moduleHelpInfo, string docsFolder, string examplesFolder)
public static void WriteMarkdowns(IEnumerable<VariantGroup> variantGroups, PsModuleHelpInfo moduleHelpInfo, string docsFolder, string examplesFolder, bool AddComplexInterfaceInfo = true)
{
Directory.CreateDirectory(docsFolder);
var markdownInfos = variantGroups.Where(vg => !vg.IsInternal).Select(vg => new MarkdownHelpInfo(vg, examplesFolder)).OrderBy(mhi => mhi.CmdletName).ToArray();
Expand Down Expand Up @@ -69,18 +69,26 @@ public static void WriteMarkdowns(IEnumerable<VariantGroup> variantGroups, PsMod
}

sb.Append($"## NOTES{Environment.NewLine}{Environment.NewLine}");
sb.Append($"ALIASES{Environment.NewLine}{Environment.NewLine}");
foreach (var alias in markdownInfo.Aliases)
if (markdownInfo.Aliases.Any())
{
sb.Append($"{alias}{Environment.NewLine}{Environment.NewLine}");
sb.Append($"ALIASES{Environment.NewLine}{Environment.NewLine}");
}
if (markdownInfo.ComplexInterfaceInfos.Any())
foreach (var alias in markdownInfo.Aliases)
{
sb.Append($"{ComplexParameterHeader}{Environment.NewLine}");
sb.Append($"{alias}{Environment.NewLine}{Environment.NewLine}");
}
foreach (var complexInterfaceInfo in markdownInfo.ComplexInterfaceInfos)

if (AddComplexInterfaceInfo)
{
sb.Append($"{complexInterfaceInfo.ToNoteOutput(includeDashes: true, includeBackticks: true)}{Environment.NewLine}{Environment.NewLine}");
if (markdownInfo.ComplexInterfaceInfos.Any())
{
sb.Append($"{ComplexParameterHeader}{Environment.NewLine}");
}
foreach (var complexInterfaceInfo in markdownInfo.ComplexInterfaceInfos)
{
sb.Append($"{complexInterfaceInfo.ToNoteOutput(includeDashes: true, includeBackticks: true)}{Environment.NewLine}{Environment.NewLine}");
}

}

sb.Append($"## RELATED LINKS{Environment.NewLine}{Environment.NewLine}");
Expand Down