跳转到主内容

项目

非官方测试版翻译

本页面由 PageTurner AI 翻译(测试版)。未经项目官方认可。 发现错误? 报告问题 →

功能

显示在包文件中定义的当前项目版本。

支持的项目类型:

  • Node.js 项目 (package.json)

  • Deno 项目 (deno.json, deno.jsonc)

  • JSR 项目 (jsr.json, jsr.jsonc)

  • Cargo 项目 (Cargo.toml)

  • Python 项目 (pyproject.toml,支持符合 PEP 621Poetry 规范的元数据)

  • 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,显示第一个匹配文件的信息)

示例配置

{
"type": "project",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#193549",
"background": "#ffeb3b",
"template": " {{ if .Error }}{{ .Error }}{{ else }}{{ if .Version }} {{.Version}}{{ end }} {{ if .Name }}{{ .Name }}{{ end }}{{ end }} "
}

选项

NameTypeDefaultDescription
always_enabledbooleanfalsealways show the segment
<type>_filesarray[]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 }}

属性

NameTypeDescription
.TypestringThe type of project:
  • node
  • deno
  • jsr
  • cargo
  • python
  • mojo
  • php
  • dart
  • nuspec
  • dotnet
  • julia
  • powershell
.VersionstringThe version of your project
.TargetstringThe target framework/language version of your project
.NamestringThe name of your project
.ErrorstringThe error context when we can't fetch the project info