Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xavier Thompson
slapos.core
Commits
8bde4899
Commit
8bde4899
authored
Oct 06, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
complete: complete "slapos service info" with service names
parent
7995db3d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
3 deletions
+27
-3
slapos/cli/complete.py
slapos/cli/complete.py
+27
-3
No files found.
slapos/cli/complete.py
View file @
8bde4899
...
@@ -93,15 +93,24 @@ class CompleteCommand(cliff.complete.CompleteCommand):
...
@@ -93,15 +93,24 @@ class CompleteCommand(cliff.complete.CompleteCommand):
# completions for slapos command generated with `slapos complete --shell=fish`
# completions for slapos command generated with `slapos complete --shell=fish`
function __fish_print_slapos_services
function __fish_print_slapos_services
eval ( commandline -o | head -1 ) service list | jq -r 'to_entries[] | "
\
(.key)
\
t
\
(.
v
alue)"'
end
function __fish_print_slapos_node_services
echo all
\
\
tAll services
eval ( commandline -o | head -1 ) node supervisorctl status | sed -e 's/ /
\
t
/'
end
function __fish_print_slapos_node_services
echo all
\
\
tAll services
echo all
\
\
tAll services
eval ( commandline -o | head -1 ) node supervisorctl status | sed -e 's/ /
\
t
/'
eval ( commandline -o | head -1 ) node supervisorctl status | sed -e 's/ /
\
t
/'
end
end
# complete installed softwares for slapos node software --only-sr
# complete installed softwares for slapos node software --only-sr
function __fish_print_slapos_softwares
function __fish_print_slapos_
node_
softwares
eval ( commandline -o | head -1 ) proxy show --software | tail -n +6 | grep available | awk '{print $4"
\
\
t"$1}'
eval ( commandline -o | head -1 ) proxy show --software | tail -n +6 | grep available | awk '{print $4"
\
\
t"$1}'
end
end
complete -c slapos -n '__fish_seen_subcommand_from node; and __fish_seen_subcommand_from software; and __fish_contains_opt only-sr only' -f -a '(__fish_print_slapos_softwares)'
complete -c slapos -n '__fish_seen_subcommand_from node; and __fish_seen_subcommand_from software; and __fish_contains_opt only-sr only' -f -a '(__fish_print_slapos_
node_
softwares)'
# complete busy partitions for slapos node instance --only-cp
# complete busy partitions for slapos node instance --only-cp
function __fish_print_slapos_partitions
function __fish_print_slapos_partitions
...
@@ -173,6 +182,21 @@ complete -c slapos -n '__fish_seen_subcommand_from node; and __fish_seen_subcom
...
@@ -173,6 +182,21 @@ complete -c slapos -n '__fish_seen_subcommand_from node; and __fish_seen_subcom
for
action
in
subcommands_actions
.
get
(
cmd_name
,
()):
for
action
in
subcommands_actions
.
get
(
cmd_name
,
()):
output_action
(
action
,
cmd_name
.
split
(
' '
))
output_action
(
action
,
cmd_name
.
split
(
' '
))
if
cmd_name
in
(
'service info'
,
):
base_cmd
,
sub_cmd
=
cmd_name
.
split
(
' '
)
self
.
app
.
stdout
.
write
(
"complete -c {slapos} -f "
" -n '__fish_seen_subcommand_from {base_cmd}; and __fish_seen_subcommand_from {sub_cmd}' "
" -a '(__fish_print_slapos_services)'
\
n
"
.
format
(
slapos
=
self
.
app
.
NAME
,
base_cmd
=
base_cmd
,
sub_cmd
=
sub_cmd
,
cmd_description
=
cmd_description
,
)
)
if
cmd_name
in
(
if
cmd_name
in
(
'node restart'
,
'node restart'
,
'node start'
,
'node start'
,
...
@@ -184,7 +208,7 @@ complete -c slapos -n '__fish_seen_subcommand_from node; and __fish_seen_subcom
...
@@ -184,7 +208,7 @@ complete -c slapos -n '__fish_seen_subcommand_from node; and __fish_seen_subcom
self
.
app
.
stdout
.
write
(
self
.
app
.
stdout
.
write
(
"complete -c {slapos} -f "
"complete -c {slapos} -f "
" -n '__fish_seen_subcommand_from {base_cmd}; and __fish_seen_subcommand_from {sub_cmd}' "
" -n '__fish_seen_subcommand_from {base_cmd}; and __fish_seen_subcommand_from {sub_cmd}' "
" -a '(__fish_print_slapos_services)'
\
n
"
.
format
(
" -a '(__fish_print_slapos_
node_
services)'
\
n
"
.
format
(
slapos
=
self
.
app
.
NAME
,
slapos
=
self
.
app
.
NAME
,
base_cmd
=
base_cmd
,
base_cmd
=
base_cmd
,
sub_cmd
=
sub_cmd
,
sub_cmd
=
sub_cmd
,
...
...
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