diff options
author | Roger Gonzalez <rogergonzalez21@gmail.com> | 2019-12-29 14:58:33 -0300 |
---|---|---|
committer | Roger Gonzalez <rogergonzalez21@gmail.com> | 2019-12-29 14:58:33 -0300 |
commit | efb336a23b65a9a2d56889396b13c1757bdaf354 (patch) | |
tree | 234e40115f79a84c8a755df6fb932cc6797e36e1 /.config/fisher/github.com/matchai/spacefish/functions/__sf_section_dotnet.fish |
Initial commit
Diffstat (limited to '.config/fisher/github.com/matchai/spacefish/functions/__sf_section_dotnet.fish')
-rw-r--r-- | .config/fisher/github.com/matchai/spacefish/functions/__sf_section_dotnet.fish | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/.config/fisher/github.com/matchai/spacefish/functions/__sf_section_dotnet.fish b/.config/fisher/github.com/matchai/spacefish/functions/__sf_section_dotnet.fish new file mode 100644 index 00000000..d46a79f1 --- /dev/null +++ b/.config/fisher/github.com/matchai/spacefish/functions/__sf_section_dotnet.fish @@ -0,0 +1,50 @@ +# +# .NET +# +# .NET Framework is a software framework developed by Microsoft. +# It includes a large class library and provides language interoperability +# across several programming languages. +# Link: https://www.microsoft.com/net + +function __sf_section_dotnet -d "Display the .NET SDK version" + # ------------------------------------------------------------------------------ + # Configuration + # ------------------------------------------------------------------------------ + + __sf_util_set_default SPACEFISH_DOTNET_SHOW true + __sf_util_set_default SPACEFISH_DOTNET_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX + __sf_util_set_default SPACEFISH_DOTNET_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX + __sf_util_set_default SPACEFISH_DOTNET_SYMBOL ".NET " + __sf_util_set_default SPACEFISH_DOTNET_COLOR "af00d7" # 128 in the original version, but renders as blue in iTerm2? + + # ------------------------------------------------------------------------------ + # Section + # ------------------------------------------------------------------------------ + + # Show current version of .NET SDK + [ $SPACEFISH_DOTNET_SHOW = false ]; and return + + # Ensure the dotnet command is available + type -q dotnet; or return + + 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 + end + + # From the + # dotnet-cli automatically handles SDK pinning (specified in a global.json file) + # therefore, this already returns the expected version for the current directory + set -l dotnet_version (dotnet --version 2>/dev/null) + + __sf_lib_section \ + $SPACEFISH_DOTNET_COLOR \ + $SPACEFISH_DOTNET_PREFIX \ + "$SPACEFISH_DOTNET_SYMBOL""$dotnet_version" \ + $SPACEFISH_DOTNET_SUFFIX +end |