Skip to content

Usage of ls and cat aliases #126

Closed
Closed
@gordonbondon

Description

@gordonbondon

There are a couple of places where ls is used instead of Get-ChildItem and cat instead of Get-Content which breaks New-ExternalHelp if you have this alias removed and use their git-bash counterparts in your environment.

ls:
https://github.com/PowerShell/platyPS/blob/master/src/platyPS/platyPS.psm1#L583
https://github.com/PowerShell/platyPS/blob/master/src/platyPS/platyPS.psm1#L854

cat:
https://github.com/PowerShell/platyPS/blob/master/src/platyPS/platyPS.psm1#L291
https://github.com/PowerShell/platyPS/blob/master/src/platyPS/platyPS.psm1#L365
https://github.com/PowerShell/platyPS/blob/master/src/platyPS/platyPS.psm1#L552

Output you get if this aliases are removed:

> New-ExternalHelp .\Docs -OutputPath .\en-US\
ls: unknown option -- e
Try '/usr/bin/ls --help' for more information.
> New-ExternalHelp .\Docs -OutputPath .\en-US\
cat: unknown option -- R
Try '/usr/bin/cat --help' for more information.
cat: unknown option -- R
Try '/usr/bin/cat --help' for more information.
cat: unknown option -- R
Try '/usr/bin/cat --help' for more information.
Get-MarkdownMetadata : Cannot bind argument to parameter 'Markdown' because it is an empty string.
At C:\Program Files\WindowsPowerShell\Modules\platyPS\0.4.0\platyPS.psm1:946 char:48
+     $metadata = Get-MarkdownMetadata -markdown $markdown
+                                                ~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Get-MarkdownMetadata], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Get-MarkdownMetadata

Exception calling "ParseString" with "2" argument(s): "Object reference not set to an instance of an object."
At C:\Program Files\WindowsPowerShell\Modules\platyPS\0.4.0\platyPS.psm1:898 char:9
+         $model = $p.ParseString($_, $parseMode)
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NullReferenceException

Exception calling "NodeModelToMamlModel" with "1" argument(s): "Object reference not set to an instance of an
object."
At C:\Program Files\WindowsPowerShell\Modules\platyPS\0.4.0\platyPS.psm1:900 char:9
+         $maml = $t.NodeModelToMamlModel($model)
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NullReferenceException

Exception calling "MamlModelToString" with "2" argument(s): "Object reference not set to an instance of an object."
At C:\Program Files\WindowsPowerShell\Modules\platyPS\0.4.0\platyPS.psm1:553 char:13
+             $xml = $r.MamlModelToString($maml, $false) # skipPreambul ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NullReferenceException

MySetContent : Cannot bind argument to parameter 'value' because it is an empty string.
At C:\Program Files\WindowsPowerShell\Modules\platyPS\0.4.0\platyPS.psm1:556 char:48
+             MySetContent -Path $outPath -Value $xml -Encoding $Encodi ...
+                                                ~~~~
    + CategoryInfo          : InvalidData: (:) [MySetContent], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,MySetContent

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions