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
aec3d81c
Verified
Commit
aec3d81c
authored
1 year ago
by
orestis.malaspin
Browse files
Options
Downloads
Patches
Plain Diff
minor correction
parent
31725ab7
No related branches found
No related tags found
No related merge requests found
Pipeline
#29439
passed
1 year ago
Stage: code_quality
Stage: test
Changes
1
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
NodeApp/src/helpers/AutoCompletionHelper.ts
+15
-17
15 additions, 17 deletions
NodeApp/src/helpers/AutoCompletionHelper.ts
with
15 additions
and
17 deletions
NodeApp/src/helpers/AutoCompletionHelper.ts
+
15
−
17
View file @
aec3d81c
...
@@ -124,31 +124,29 @@ function generateCommandChain(cmd: Command | null): string {
...
@@ -124,31 +124,29 @@ function generateCommandChain(cmd: Command | null): string {
return
data
.
trimEnd
()
return
data
.
trimEnd
()
}
}
function
optionsToString
(
cmd
:
Command
):
string
{
if
(
cmd
.
options
.
length
==
0
)
{
return
''
}
return
cmd
.
options
.
filter
(
opt
=>
!
opt
.
hidden
).
map
(
opt
=>
{
return
`
${
prefix
}
${
computeHeigth
(
cmd
)}
${
generateCommandChain
(
cmd
)}
' -a "--
${
opt
.
name
()}
" -d "
${
opt
.
description
}
"`
}).
join
(
'
\n
'
).
concat
(
'
\n
'
)
}
export
function
writeFishCompletion
(
root
:
Command
,
filename
:
string
)
{
export
function
writeFishCompletion
(
root
:
Command
,
filename
:
string
)
{
const
commands
=
flatten
(
root
)
const
commands
=
flatten
(
root
)
let
data
=
fishFunction
let
data
=
fishFunction
// add commands and subcommands
// add commands and subcommands
commands
.
forEach
(
cmd
=>
{
commands
.
forEach
(
cmd
=>
{
if
(
isLeaf
(
cmd
)
)
{
data
+=
optionsToString
(
cmd
)
cmd
.
options
.
forEach
(
opt
=>
{
if
(
!
isLeaf
(
cmd
))
{
if
(
!
opt
.
hidden
)
{
data
+=
cmd
.
commands
.
map
(
subCmd
=>
{
data
+=
`
${
prefix
}
${
computeHeigth
(
cmd
)}
${
generateCommandChain
(
cmd
)}
' -a
"--
${
opt
.
name
()}
"
-d "
${
opt
.
description
}
"
\n
`
return
`
${
prefix
}
${
computeHeigth
(
cmd
)}
${
generateCommandChain
(
cmd
)}
' -a
${
subCmd
.
name
()}
-d "
${
subCmd
.
description
()
}
"`
}).
join
(
'
\n
'
).
concat
(
'
\n
'
)
}
}
})
})
}
cmd
.
commands
.
forEach
(
subCmd
=>
{
data
+=
`
${
prefix
}
${
computeHeigth
(
cmd
)}
${
generateCommandChain
(
cmd
)}
' -a
${
subCmd
.
name
()}
-d "
${
subCmd
.
description
()}
"\n`
if
(
cmd
.
options
.
length
>
0
)
{
cmd
.
options
.
forEach
(
opt
=>
{
if
(
!
opt
.
hidden
)
{
data
+=
`
${
prefix
}
${
computeHeigth
(
cmd
)}
${
generateCommandChain
(
cmd
)}
' -a "--
${
opt
.
name
()}
" -d "
${
opt
.
description
}
"\n`
}
})
}
})
})
writeFileSync
(
filename
,
data
);
writeFileSync
(
filename
,
data
);
}
}
...
...
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