项目
非官方测试版翻译
本页面由 PageTurner AI 翻译(测试版)。未经项目官方认可。 发现错误? 报告问题 →
功能
显示在包文件中定义的当前项目版本。
支持的项目类型:
-
Node.js 项目 (
package.json) -
Deno 项目 (
deno.json,deno.jsonc) -
JSR 项目 (
jsr.json,jsr.jsonc) -
Cargo 项目 (
Cargo.toml) -
Mojo 项目 (
mojoproject.toml) -
PHP 项目 (
composer.json) -
Dart 项目 (
pubspec.yaml) -
任何基于 nuspec 的项目 (
*.nuspec,显示第一个匹配文件的信息) -
.NET 项目 (
*.sln,*.slnf,*.slnx,*.csproj,*.vbproj或*.fsproj,显示第一个匹配文件的信息) -
Julia 项目 (
JuliaProject.toml,Project.toml) -
PowerShell 项目 (
*.psd1,显示第一个匹配文件的信息)
示例配置
- json
- yaml
- toml
{
"type": "project",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#193549",
"background": "#ffeb3b",
"template": " {{ if .Error }}{{ .Error }}{{ else }}{{ if .Version }} {{.Version}}{{ end }} {{ if .Name }}{{ .Name }}{{ end }}{{ end }} "
}
type: project
style: powerline
powerline_symbol:
foreground: "#193549"
background: "#ffeb3b"
template: " {{ if .Error }}{{ .Error }}{{ else }}{{ if .Version }}
{{.Version}}{{ end }} {{ if .Name }}{{ .Name }}{{ end }}{{ end }} "
type = "project"
style = "powerline"
powerline_symbol = ""
foreground = "#193549"
background = "#ffeb3b"
template = " {{ if .Error }}{{ .Error }}{{ else }}{{ if .Version }} {{.Version}}{{ end }} {{ if .Name }}{{ .Name }}{{ end }}{{ end }} "
选项
| Name | Type | Default | Description |
|---|---|---|---|
always_enabled | boolean | false | always show the segment |
<type>_files | array | [] | override the project's files to validate for. Use the .Type values listed below to override (e.g. dotnet_files) |
模板 (信息)
默认模板
{{ if .Error }}{{ .Error }}{{ else }}{{ if .Version }}\uf487 {{.Version}}{{ end }} {{ if .Name }}{{ .Name }}{{ end }}{{ end }}
属性
| Name | Type | Description |
|---|---|---|
.Type | string | The type of project:
|
.Version | string | The version of your project |
.Target | string | The target framework/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 |