works, [non]interactively
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
# giteapi
|
||||||
|
|
||||||
|
Creates ticket from command line
|
||||||
|
|
||||||
|
Relies on a ~/.gitapi in bash format:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
server=url of gitea server
|
||||||
|
token=application token - read write access to issues
|
||||||
|
repo=name of repo
|
||||||
|
user=repo owner
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage:
|
||||||
|
|
||||||
|
Interactive use: just run the script
|
||||||
|
|
||||||
|
Non-interactive: script will accept following command line arguments:
|
||||||
|
|
||||||
|
1. client
|
||||||
|
2. ticket title
|
||||||
|
3. ticket body
|
||||||
|
|
||||||
+15
-3
@@ -14,9 +14,21 @@ test -r $configFile || {
|
|||||||
|
|
||||||
source $configFile
|
source $configFile
|
||||||
|
|
||||||
url=${server}/api/v1/
|
url=${server}/api/v1/repos/$user/${repo}///issues
|
||||||
|
|
||||||
#curl -H "Authorization: Bearer ${token}" "${url}/repos/tom/Support/issues" -d '{"state": "close"}' -H 'Content-Type: application/json' -X GET
|
if [ $# -gt 0 ] ; then
|
||||||
curl -H "Authorization: Bearer ${token}" "${url}/repos/tom/Support/issues" -X POST -d '{"title": "test"}' -H 'Content-Type: application/json'
|
customer=$1
|
||||||
|
title=$2
|
||||||
|
text=$3
|
||||||
|
else
|
||||||
|
read -p "customer: " customer
|
||||||
|
read -p "title: " title
|
||||||
|
read -p "text - use \\n for multiline " text
|
||||||
|
fi
|
||||||
|
|
||||||
|
data="{ \"title\": \"$customer $title\",\"state\": \"open\",\"body\": \"$text\"}"
|
||||||
|
echo "$data"
|
||||||
|
|
||||||
|
curl -H "Authorization: Bearer ${token}" "${url}" -X POST -H 'Content-Type: application/json' -d "$data"
|
||||||
|
|
||||||
[ $? -eq 0 ] && { echo issue created ; }
|
[ $? -eq 0 ] && { echo issue created ; }
|
||||||
Reference in New Issue
Block a user