Skip to content

Instantly share code, notes, and snippets.

@grantwinney grantwinney/mentor.sh
Last active Aug 7, 2018

Embed
What would you like to do?
A script to make mentoring C# solutions on Exercism a little easier
#!/bin/bash
### check for proper usage
if [ $# -ne 1 ]; then
echo $0: usage: uuid_for_solution
exit 1
fi
cd ~
### download solution
local_solution_path=`exercism download --uuid=$1` # where exercism downloaded solution
printf "$local_solution_path\n\n"
### append '_orig' to original file name; rename user's solution that starts with \\
cd $local_solution_path
find . -name '\\\\*.cs' | while read fname; do
norm_name=`echo "$fname" | tr -d '\\'`
mv "$norm_name" "$norm_name"_orig
mv "\\`basename $fname`" "$norm_name"
done
### enable all tests (remove skip attribute)
sed -i '' 's/(Skip = "Remove to run test")//g' *Test.cs
### opt out of data collection and trust the ASP.NET Core HTTPS Development Certificate
export DOTNET_CLI_TELEMETRY_OPTOUT='true' # https://aka.ms/dotnet-cli-telemetry
dotnet dev-certs https --trust # https://go.microsoft.com/fwlink/?linkid=848054
# https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet?tabs=netcore21#additional-tools
### run tests and open the solution (add -n to open a new window)
dotnet test # https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-test
open $local_solution_path/*.csproj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.