From 3ed9e45a6b4f6bb78bda1d5df5b13874aef53721 Mon Sep 17 00:00:00 2001 From: Wryn Wagner Date: Mon, 28 Jun 2021 11:26:34 -0600 Subject: [PATCH] dotnet builder function --- vim/testing.vim | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/vim/testing.vim b/vim/testing.vim index 3010277..ca365c6 100644 --- a/vim/testing.vim +++ b/vim/testing.vim @@ -77,12 +77,25 @@ function DotnetTest(filter = '') call TmuxTest(l:command) endfunction +function DotnetBuild() + let l:command = + \ 'cd ' . GetDotnetProjectLocation() + \ . ';' . 'dotnet build -clp:ErrorsOnly' + + call TmuxTest(l:command) +endfunction + function GetDotnetProjectLocation(test = 0) let l:projectRoot = substitute(expand(getcwd()), '/code.*', '/code', '') + let l:projectName = substitute(expand(getcwd()), l:projectRoot . '/\([^/]*\).*', '\1', '') if a:test let l:testPath = system('ls ' . l:projectRoot . '/**/*.csproj | grep Test | head -1') else - let l:testPath = system('ls ' . l:projectRoot . '/**/*.csproj | grep -v Test | head -1') + if l:projectName != '' + let l:testPath = l:projectRoot . '/' . l:projectName + else + let l:testPath = system('ls ' . l:projectRoot . '/**/*.csproj | grep -v Test | head -1') + endif endif return substitute(l:testPath, '\(.*\)/.*.csproj.*', '\1', '') endfunction