mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-28 04:19:41 -08:00
feat(project): add support for Julia
This commit is contained in:
parent
2ff98e2c81
commit
f965dc49aa
|
@ -117,6 +117,11 @@ func (n *Project) Init(props properties.Properties, env platform.Environment) {
|
|||
Files: []string{"*.vbproj", "*.fsproj", "*.csproj"},
|
||||
Fetcher: n.getDotnetProject,
|
||||
},
|
||||
{
|
||||
Name: "julia",
|
||||
Files: []string{"JuliaProject.toml", "Project.toml"},
|
||||
Fetcher: n.getProjectData,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -226,3 +231,16 @@ func (n *Project) getDotnetProject(item ProjectItem) *ProjectData {
|
|||
Name: name,
|
||||
}
|
||||
}
|
||||
|
||||
func (n *Project) getProjectData(item ProjectItem) *ProjectData {
|
||||
content := n.env.FileContent(item.Files[0])
|
||||
|
||||
var data ProjectData
|
||||
_, err := toml.Decode(content, &data)
|
||||
if err != nil {
|
||||
n.Error = err.Error()
|
||||
return nil
|
||||
}
|
||||
|
||||
return &data
|
||||
}
|
||||
|
|
|
@ -186,6 +186,37 @@ func TestPackage(t *testing.T) {
|
|||
File: "Cargo.toml",
|
||||
PackageContents: "[",
|
||||
},
|
||||
{
|
||||
Case: "Julia project",
|
||||
ExpectedEnabled: true,
|
||||
ExpectedString: "\uf487 0.1.0 ProjectEuler",
|
||||
Name: "julia",
|
||||
File: "JuliaProject.toml",
|
||||
PackageContents: "name = \"ProjectEuler\"\nversion = \"0.1.0\"",
|
||||
},
|
||||
{
|
||||
Case: "Julia project no name",
|
||||
ExpectedEnabled: true,
|
||||
ExpectedString: "\uf487 0.1.0",
|
||||
Name: "julia",
|
||||
File: "JuliaProject.toml",
|
||||
PackageContents: "version = \"0.1.0\"",
|
||||
},
|
||||
{
|
||||
Case: "Julia project no version",
|
||||
ExpectedEnabled: true,
|
||||
ExpectedString: "ProjectEuler",
|
||||
Name: "julia",
|
||||
File: "JuliaProject.toml",
|
||||
PackageContents: "name = \"ProjectEuler\"",
|
||||
},
|
||||
{
|
||||
Case: "Julia project invalid toml",
|
||||
ExpectedString: "toml: line 1: unexpected end of table name (table names cannot be empty)",
|
||||
Name: "julia",
|
||||
File: "JuliaProject.toml",
|
||||
PackageContents: "[",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
|
|
|
@ -16,6 +16,7 @@ Supports:
|
|||
- PHP project (`composer.json`)
|
||||
- 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`)
|
||||
|
||||
## Sample Configuration
|
||||
|
||||
|
|
Loading…
Reference in a new issue