fix(project): exclude powershell script analyzer settings file

resolves #4188
This commit is contained in:
Jan De Dobbeleer 2023-08-27 10:25:56 +02:00 committed by Jan De Dobbeleer
parent b5bde55cf2
commit b2f3a43d19
2 changed files with 22 additions and 17 deletions

View file

@ -237,8 +237,9 @@ func (n *Project) getPowerShellModuleData(_ ProjectItem) *ProjectData {
files := n.env.LsDir(n.env.Pwd())
var content string
// get the first match only
// excluding PSScriptAnalyzerSettings.psd1
for _, file := range files {
if filepath.Ext(file.Name()) == ".psd1" {
if filepath.Ext(file.Name()) == ".psd1" && file.Name() != "PSScriptAnalyzerSettings.psd1" {
content = n.env.FileContent(file.Name())
break
}

View file

@ -17,19 +17,23 @@ Supports:
- Any nuspec based project (`*.nuspec`, first file match info is displayed)
- .NET project (`*.csproj`, `*.vbproj` or `*.fsproj`, first file match info is displayed)
- Julia project (`JuliaProject.toml`, `Project.toml`)
- PowerShell project (`*.psd1`, first file match info is displayed)
## Sample Configuration
import Config from '@site/src/components/Config.js';
import Config from "@site/src/components/Config.js";
<Config data={{
"type": "project",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#193549",
"background": "#ffeb3b",
"template": " {{ if .Error }}{{ .Error }}{{ else }}{{ if .Version }}\uf487 {{.Version}}{{ end }} {{ if .Name }}{{ .Name }}{{ end }}{{ end }} "
}}/>
<Config
data={{
type: "project",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#193549",
background: "#ffeb3b",
template:
" {{ if .Error }}{{ .Error }}{{ else }}{{ if .Version }}\uf487 {{.Version}}{{ end }} {{ if .Name }}{{ .Name }}{{ end }}{{ end }} ",
}}
/>
## Properties
@ -49,12 +53,12 @@ import Config from '@site/src/components/Config.js';
### Properties
| Name | Type | Description |
| ---------- | -------- | ------------------------------------------------------------------------------------- |
| `.Type` | `string` | The type of project (`node`, `cargo`, `poetry`, `php`, `nuspec`, `dotnet` or `julia`) |
| `.Version` | `string` | The version of your project |
| `.Target` | `string` | The target framwork/language version of your project |
| `.Name` | `string` | The name of your project |
| `.Error` | `string` | The error context when we can't fetch the project info |
| Name | Type | Description |
| ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `.Type` | `string` | The type of project:<ul><li>`node`</li><li>`cargo`</li><li>`poetry`</li><li>`php`</li><li>`nuspec`</li><li>`dotnet`</li><li>`julia`</li><li>`powershell`</li></ul> |
| `.Version` | `string` | The version of your project |
| `.Target` | `string` | The target framwork/language version of your project |
| `.Name` | `string` | The name of your project |
| `.Error` | `string` | The error context when we can't fetch the project info |
[templates]: /docs/configuration/templates