Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DojoCLI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dojo Project (HES-SO)
Projects
UI
DojoCLI
Commits
3a29dec8
Commit
3a29dec8
authored
1 year ago
by
michael.minelli
Browse files
Options
Downloads
Patches
Plain Diff
AssignmentCheckCommand => Add two levels of verbose
parent
f4329f5e
No related branches found
No related tags found
No related merge requests found
Pipeline
#28482
passed
1 year ago
Stage: code_quality
Stage: test
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
NodeApp/src/commander/assignment/subcommands/AssignmentCheckCommand.ts
+21
-9
21 additions, 9 deletions
...ommander/assignment/subcommands/AssignmentCheckCommand.ts
NodeApp/src/sharedByClients
+1
-1
1 addition, 1 deletion
NodeApp/src/sharedByClients
with
22 additions
and
10 deletions
NodeApp/src/commander/assignment/subcommands/AssignmentCheckCommand.ts
+
21
−
9
View file @
3a29dec8
...
...
@@ -4,6 +4,7 @@ import ora from 'ora';
import
chalk
from
'
chalk
'
;
import
AssignmentValidator
from
'
../../../sharedByClients/helpers/Dojo/AssignmentValidator
'
;
import
ClientsSharedAssignmentHelper
from
'
../../../sharedByClients/helpers/Dojo/ClientsSharedAssignmentHelper
'
;
import
{
Option
}
from
'
commander
'
;
class
AssignmentCheckCommand
extends
CommanderCommand
{
...
...
@@ -13,11 +14,15 @@ class AssignmentCheckCommand extends CommanderCommand {
this
.
command
.
description
(
'
locally run a check of an assignment
'
)
.
option
(
'
-p, --path <value>
'
,
'
assignment path
'
,
Config
.
folders
.
defaultLocalExercise
)
.
option
(
'
-v, --verbose
'
,
'
verbose mode (display docker compose logs in live)
'
)
.
option
(
'
-v, --verbose
'
,
'
verbose mode - display principal container output in live
'
)
.
addOption
(
new
Option
(
'
-w, --super-verbose
'
,
'
verbose mode - display all docker compose logs (build included) in live
'
).
conflicts
(
'
verbose
'
))
.
addOption
(
new
Option
(
'
--verbose-ssj2
'
).
hideHelp
().
implies
({
superVerbose
:
true
}))
.
action
(
this
.
commandAction
.
bind
(
this
));
}
protected
async
commandAction
(
options
:
{
path
:
string
,
verbose
:
boolean
}):
Promise
<
void
>
{
protected
async
commandAction
(
options
:
{
path
:
string
,
verbose
:
boolean
,
superVerbose
:
boolean
}):
Promise
<
void
>
{
const
verbose
:
boolean
=
options
.
verbose
||
options
.
superVerbose
;
const
localExercisePath
:
string
=
options
.
path
??
Config
.
folders
.
defaultLocalExercise
;
const
assignmentValidator
=
new
AssignmentValidator
(
localExercisePath
);
...
...
@@ -26,10 +31,17 @@ class AssignmentCheckCommand extends CommanderCommand {
await
new
Promise
<
void
>
((
resolve
,
reject
)
=>
{
let
spinner
:
ora
.
Ora
;
if
(
options
.
verbose
)
{
assignmentValidator
.
events
.
on
(
'
logs
'
,
(
log
:
string
,
_error
:
boolean
,
displayable
:
boolean
)
=>
{
if
(
displayable
)
{
console
.
log
(
log
);
if
(
verbose
)
{
let
buildPhase
:
boolean
=
true
;
assignmentValidator
.
events
.
on
(
'
logs
'
,
(
log
:
string
,
_error
:
boolean
,
displayable
:
boolean
,
_currentStep
:
string
,
currentSubStep
:
string
)
=>
{
for
(
const
line
of
log
.
split
(
'
\n
'
)
)
{
if
(
currentSubStep
==
'
COMPOSE_RUN
'
&&
buildPhase
&&
line
!=
''
&&
!
line
.
startsWith
(
'
#
'
)
)
{
buildPhase
=
false
;
}
if
(
displayable
&&
(
options
.
superVerbose
||
!
buildPhase
)
)
{
console
.
log
(
line
);
}
}
});
}
...
...
@@ -44,14 +56,14 @@ class AssignmentCheckCommand extends CommanderCommand {
indent
:
4
}).
start
();
if
(
options
.
verbose
&&
name
==
'
COMPOSE_RUN
'
)
{
if
(
verbose
&&
name
==
'
COMPOSE_RUN
'
)
{
spinner
.
info
();
}
});
assignmentValidator
.
events
.
on
(
'
endSubStep
'
,
(
stepName
:
string
,
message
:
string
,
error
:
boolean
)
=>
{
if
(
error
)
{
if
(
options
.
verbose
&&
stepName
==
'
COMPOSE_RUN
'
)
{
if
(
verbose
&&
stepName
==
'
COMPOSE_RUN
'
)
{
ora
({
text
:
message
,
indent
:
4
...
...
@@ -60,7 +72,7 @@ class AssignmentCheckCommand extends CommanderCommand {
spinner
.
fail
(
message
);
}
}
else
{
if
(
options
.
verbose
&&
stepName
==
'
COMPOSE_RUN
'
)
{
if
(
verbose
&&
stepName
==
'
COMPOSE_RUN
'
)
{
ora
({
text
:
message
,
indent
:
4
...
...
This diff is collapsed.
Click to expand it.
sharedByClients
@
68f6ffc2
Compare
04e9ad7c
...
68f6ffc2
Subproject commit
04e9ad7c9f53fe47ffb2ef6f2c0266e28c1c963b
Subproject commit
68f6ffc241fabf4fd288871713419aab1d2d9f50
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment