Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etersoft-build-utils
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
korinf
etersoft-build-utils
Commits
0f565bee
You need to sign in or sign up before continuing.
Commit
0f565bee
authored
Oct 23, 2020
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gitask: add support for tasks with # in the begin
parent
d150a170
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
17 deletions
+31
-17
gitask
bin/gitask
+31
-17
No files found.
bin/gitask
View file @
0f565bee
...
...
@@ -40,6 +40,18 @@ if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
exit
0
fi
# with support for #NUM
is_task_number
()
{
echo
"
$*
"
| estrlist filter_strip_spaces |
grep
-q
"^#
\?
[0-9]
\+
$"
}
# clean from possible #
get_task_number
()
{
echo
"
$*
"
| estrlist filter_strip_spaces |
sed
-e
"s|^#||"
}
get_last
()
{
ssh
$GEARHOST
task
ls
|
head
-n1
|
sed
-e
"s|^#
\(
[0-9]*
\)
.*|
\1
|g"
...
...
@@ -64,7 +76,7 @@ if [ "$1" = "get" ] ; then
if
[
"
$1
$2
"
=
"get subtask"
]
;
then
[
-n
"
$3
"
]
||
fatal
"get subtask TASK PROJECTNAME"
[
-n
"
$4
"
]
||
fatal
"get subtask
$3
PROJECTNAME"
get_subtask
"
$
3
"
"
$4
"
get_subtask
"
$
(
get_task_number
$3
)
"
"
$4
"
exit
elif
[
"
$1
$2
$3
"
=
"get last "
]
||
[
"
$1
$2
$3
"
=
"get last task"
]
;
then
get_last
...
...
@@ -120,7 +132,7 @@ fi
if
[
"
$1
"
=
"log"
]
;
then
shift
TASK
=
"
$
1
"
TASK
=
"
$
(
get_task_number
$1
)
"
[
-n
"
$TASK
"
]
||
TASK
=
"
$(
get_last
)
"
||
fatal
showcmd
"
$GEARHOST
>"
girar-show
"
$TASK
"
GIT_ALT
=
$GEARHOST
girar-show
"
$TASK
"
...
...
@@ -147,7 +159,7 @@ fi
if
[
"
$1
"
=
"delsub"
]
;
then
shift
TASK
=
"
$
1
"
TASK
=
"
$
(
get_task_number
$1
)
"
[
-n
"
$TASK
"
]
||
TASK
=
"
$(
get_last
)
"
||
fatal
shift
while
[
-n
"
$1
"
]
;
do
...
...
@@ -197,12 +209,12 @@ if [ "$1" = "add" ] ; then
ADDCMD
=
''
ADDCMDLIST
=
"del copy repo rebuild"
# add TASKNUMBER package
if
isnumber
"
$2
"
&&
estrlist has
"
$3
"
$ADDCMDLIST
;
then
TASK
=
"
$
2
"
if
is
_task_
number
"
$2
"
&&
estrlist has
"
$3
"
$ADDCMDLIST
;
then
TASK
=
"
$
(
get_task_number
$2
)
"
ADDCMD
=
"
$3
"
shift
3
elif
isnumber
"
$2
"
&&
isnumber
"
$3
"
&&
estrlist has
"
$4
"
$ADDCMDLIST
;
then
TASK
=
"
$
2
"
elif
is
_task_
number
"
$2
"
&&
isnumber
"
$3
"
&&
estrlist has
"
$4
"
$ADDCMDLIST
;
then
TASK
=
"
$
(
get_task_number
$2
)
"
SUBTASK
=
"
$3
"
ADDCMD
=
"
$4
"
shift
4
...
...
@@ -234,11 +246,11 @@ fi
if
[
"
$1
"
=
"show"
]
;
then
shift
COMMIT
=
''
TASK
LIST
=
"
$1
"
if
[
-z
"
$TASK
LIST
"
]
;
then
TASK
LIST
=
"
$(
get_last
)
"
||
fatal
"Can't get last task"
TASK
=
"
$(
get_task_number
$1
)
"
if
[
-z
"
$TASK
"
]
;
then
TASK
=
"
$(
get_last
)
"
||
fatal
"Can't get last task"
fi
docmd ssh
$GEARHOST
task show
"
$TASK
LIST
"
docmd ssh
$GEARHOST
task show
"
$TASK
"
exit
fi
...
...
@@ -254,7 +266,8 @@ if [ "$1" = "run" ] || [ "$1" = "commit" ] ; then
while
[
-n
"
$1
"
]
;
do
# TODO: check for number?
if
echo
"
$1
"
|
grep
-qv
"^-"
;
then
TASKLIST
=
"
$TASKLIST
$1
"
TASK
=
"
$(
get_task_number
$1
)
"
TASKLIST
=
"
$TASKLIST
$TASK
"
elif
[
"
$1
"
=
"-m"
]
;
then
#MESSAGE="$1 ${2// /_}"
MESSAGE
=
"-m -"
...
...
@@ -276,18 +289,19 @@ fi
if
[
"
$1
"
=
"cancel"
]
;
then
shift
#TASK="$(get_last)" || fatal
TASK
=
"
$(
get_task_number
$1
)
"
if
[
"
$GEARHOST
"
=
"git.eter"
]
||
[
"
$GEARHOST
"
=
"git.office"
]
;
then
docmd ssh
$GEARHOST
task cancel
"
$
@
"
docmd ssh
$GEARHOST
task cancel
"
$
TASK
"
else
docmd ssh
$GEARHOST
task abort
"
$
@
"
docmd ssh
$GEARHOST
task abort
"
$
TASK
"
fi
exit
fi
if
[
"
$1
"
=
"share"
]
&&
[
-n
"
$2
"
]
;
then
#shift
docmd ssh
$GEARHOST
task share
"
$2
"
enable
shift
TASK
=
"
$(
get_task_number
$1
)
"
docmd ssh
$GEARHOST
task share
"
$TASK
"
enable
exit
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment