Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
feat: add support for F# project detection in the dotnet section
Browse files Browse the repository at this point in the history
Shows the dotnet section when `paket.dependencies` or `*.fsproj` are present in the current directory.
  • Loading branch information
yjpark authored and matchai committed Feb 2, 2019
1 parent 7a49adb commit c104b04
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ Rust section is shown only in directories that contain `Cargo.toml` or any other

### .NET (`dotnet`)

.NET section is shown only in directories that contains a `project.json` or `global.json` file, or a file with one of these extensions: `.csproj`, `.xproj` or `.sln`.
.NET section is shown only in directories that contains a `project.json`, `global.json` or `paket.dependencies` file, or a file with one of these extensions: `.csproj`, `.xproj`, `.fproj` or `.sln`.

| Variable | Default | Meaning |
| :------- | :-----: | ------- |
Expand Down
2 changes: 2 additions & 0 deletions functions/__sf_section_dotnet.fish
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ function __sf_section_dotnet -d "Display the .NET SDK version"

if not test -f project.json \
-o -f global.json \
-o -f paket.dependencies \
-o (count *.csproj) -gt 0 \
-o (count *.fsproj) -gt 0 \
-o (count *.xproj) -gt 0 \
-o (count *.sln) -gt 0
return
Expand Down
34 changes: 34 additions & 0 deletions tests/__sf_section_dotnet.test.fish
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ test "Prints nothing when required files are missing"
(
rm -f /tmp/tmp-spacefish/project.json
rm -f /tmp/tmp-spacefish/global.json
rm -f /tmp/tmp-spacefish/paket.dependencies
rm -f '/tmp/tmp-spacefish/*.sln'
rm -f '/tmp/tmp-spacefish/*.csproj'
rm -f '/tmp/tmp-spacefish/*.fsproj'
rm -f '/tmp/tmp-spacefish/*.xproj'
) = (__sf_section_dotnet)
end
Expand Down Expand Up @@ -53,6 +55,22 @@ test "Prints section if global.json is present"
) = (__sf_section_dotnet)
end

test "Prints section if paket.dependencies is present"
(
touch /tmp/tmp-spacefish/paket.dependencies
set_color --bold

echo -n "via "
set_color normal
set_color --bold af00d7
echo -n ".NET 2.1.403"
set_color normal
set_color --bold
echo -n " "
set_color normal
) = (__sf_section_dotnet)
end

test "Prints section if a .csproj file is present"
(
touch /tmp/tmp-spacefish/tmp.csproj
Expand All @@ -69,6 +87,22 @@ test "Prints section if a .csproj file is present"
) = (__sf_section_dotnet)
end

test "Prints section if a .fsproj file is present"
(
touch /tmp/tmp-spacefish/tmp.fsproj

set_color --bold
echo -n "via "
set_color normal
set_color --bold af00d7
echo -n ".NET 2.1.403"
set_color normal
set_color --bold
echo -n " "
set_color normal
) = (__sf_section_dotnet)
end

test "Prints section if a .xproj file is present"
(
touch /tmp/tmp-spacefish/tmp.xproj
Expand Down

0 comments on commit c104b04

Please sign in to comment.