Committer: root <root@fruw.org>
This commit is contained in:
21
shell/go-git/LICENSE
Normal file
21
shell/go-git/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 Mitch Conner
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
9
shell/go-git/README.md
Normal file
9
shell/go-git/README.md
Normal file
@ -0,0 +1,9 @@
|
||||
### go-git
|
||||
Создаёт шаблон кода на GO и коммитит его на Гитхаб.
|
||||
```
|
||||
repo
|
||||
∟ go.mod
|
||||
∟ main.go
|
||||
∟ README.md
|
||||
∟ commit-repo.sh
|
||||
```
|
58
shell/go-git/go-git.sh
Normal file
58
shell/go-git/go-git.sh
Normal file
@ -0,0 +1,58 @@
|
||||
#!/bin/bash
|
||||
if [ ! -f username ]; then
|
||||
echo Введи ник:
|
||||
read username
|
||||
echo Введи токен:
|
||||
read token
|
||||
echo "$token" > token
|
||||
echo "$username" > username
|
||||
else
|
||||
token=$(cat token)
|
||||
username=$(cat username)
|
||||
fi
|
||||
echo Введи имя репозитория:
|
||||
read repo
|
||||
title="
|
||||
username="$username"
|
||||
repo="$repo"
|
||||
token="$token"
|
||||
"
|
||||
commit='
|
||||
gh auth login --with-token < ../token > /dev/null
|
||||
if (! gh repo view "$repo" 1> /dev/null 2> /dev/null); then
|
||||
gh repo create "$repo" --public 1> /dev/null
|
||||
fi
|
||||
git init 1> /dev/null 2> /dev/null
|
||||
git add .
|
||||
git rm --cached commit-"$repo".sh 1> /dev/null
|
||||
echo Введи имя коммита:
|
||||
read commit
|
||||
git commit -m "$commit"
|
||||
git branch -M main
|
||||
git push --set-upstream https://"$token"@github.com/"$username"/"$repo".git main
|
||||
'
|
||||
main='package main
|
||||
|
||||
import (
|
||||
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
}'
|
||||
mod="
|
||||
module github.com/"$username"/"$repo"
|
||||
|
||||
go 1.17
|
||||
|
||||
require (
|
||||
)
|
||||
"
|
||||
mkdir "$repo"
|
||||
cd "./$repo"
|
||||
echo "### $repo" > README.md
|
||||
echo "$main" > main.go
|
||||
echo "$mod" > mod.go
|
||||
echo "$title" > commit-"$repo".sh
|
||||
echo "$commit" >> commit-"$repo".sh
|
||||
chmod 775 commit-"$repo".sh
|
Reference in New Issue
Block a user