Created
February 1, 2025 14:40
-
-
Save IamADav/2fcf0522d53e6d5074e71a90b5dc433d to your computer and use it in GitHub Desktop.
Generate a class that can be used as a stamp.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| file=$1 | |
| url=`git config --get remote.origin.url` | |
| branch=`git rev-parse --abbrev-ref HEAD` | |
| gitedate=`git show -s --format=%ci` | |
| sha=`git show -s --format=%H` | |
| echo $gitedate | |
| printf "namespace $2\r"> $file | |
| printf "{\r ">> $file | |
| printf " public class InfoVersion\r ">> $file | |
| printf " {\r ">> $file | |
| printf " public string Repo { get; set; }\r ">> $file | |
| printf " public string Branch { get; set; }\r ">> $file | |
| printf " public string Date { get; set; }\r ">> $file | |
| printf " public string Sha { get; set; }\r ">> $file | |
| printf " public string ComputerName { get; set; }\r ">> $file | |
| printf " public string CompileDate { get; set; }\r ">> $file | |
| printf "\r ">> $file | |
| printf " public InfoVersion()\r ">> $file | |
| printf " {\r ">> $file | |
| printf " Repo = \"$url\";\r ">> $file | |
| printf " Branch = \"$branch\";\r ">> $file | |
| printf " Date = \"$gitedate\";\r ">> $file | |
| printf " Sha = \"$sha\";\r ">> $file | |
| printf " ComputerName = \"Gitlab\";\r ">> $file | |
| printf " CompileDate = \"$(date)\";\r ">> $file | |
| printf " }\r ">> $file | |
| printf " }\r ">> $file | |
| printf "}\r" >> $file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment