Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
68d28e37
Unverified
Commit
68d28e37
authored
Jul 15, 2025
by
Reid
Committed by
GitHub
Jul 15, 2025
Browse files
[frontend] Add --help=page option for paginated help output (#20961)
Signed-off-by:
reidliu41
<
reid201711@gmail.com
>
parent
37a7d5d7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
8 deletions
+39
-8
docs/cli/README.md
docs/cli/README.md
+3
-0
vllm/entrypoints/utils.py
vllm/entrypoints/utils.py
+36
-8
No files found.
docs/cli/README.md
View file @
68d28e37
...
...
@@ -37,6 +37,9 @@ Start the vLLM OpenAI Compatible API server.
# To search by keyword
vllm serve --help=max
# To view full help with pager (less/more)
vllm serve --help=page
```
## chat
...
...
vllm/entrypoints/utils.py
View file @
68d28e37
...
...
@@ -5,6 +5,7 @@ import argparse
import
asyncio
import
functools
import
os
import
subprocess
import
sys
from
typing
import
Any
,
Optional
,
Union
...
...
@@ -25,7 +26,8 @@ VLLM_SUBCMD_PARSER_EPILOG = (
" - To view a argument group: --help=ModelConfig
\n
"
" - To view a single argument: --help=max-num-seqs
\n
"
" - To search by keyword: --help=max
\n
"
" - To list all groups: --help=listgroup"
)
" - To list all groups: --help=listgroup
\n
"
" - To view help with pager: --help=page"
)
async
def
listen_for_disconnect
(
request
:
Request
)
->
None
:
...
...
@@ -190,6 +192,24 @@ def _validate_truncation_size(
return
truncate_prompt_tokens
def
_output_with_pager
(
text
:
str
):
"""Output text using scrolling view if available and appropriate."""
pagers
=
[
'less -R'
,
'more'
]
for
pager_cmd
in
pagers
:
try
:
proc
=
subprocess
.
Popen
(
pager_cmd
.
split
(),
stdin
=
subprocess
.
PIPE
,
text
=
True
)
proc
.
communicate
(
input
=
text
)
return
except
(
subprocess
.
SubprocessError
,
OSError
,
FileNotFoundError
):
continue
# No pager worked, fall back to normal print
print
(
text
)
def
show_filtered_argument_or_group_from_help
(
parser
:
argparse
.
ArgumentParser
,
subcommand_name
:
list
[
str
]):
...
...
@@ -208,16 +228,24 @@ def show_filtered_argument_or_group_from_help(parser: argparse.ArgumentParser,
if
arg
.
startswith
(
'--help='
):
search_keyword
=
arg
.
split
(
'='
,
1
)[
1
]
# Enable paged view for full help
if
search_keyword
==
'page'
:
help_text
=
parser
.
format_help
()
_output_with_pager
(
help_text
)
sys
.
exit
(
0
)
# List available groups
if
search_keyword
==
'listgroup'
:
print
(
"
\n
Available argument groups:"
)
output_lines
=
[
"
\n
Available argument groups:"
]
for
group
in
parser
.
_action_groups
:
if
group
.
title
and
not
group
.
title
.
startswith
(
"positional arguments"
):
print
(
f
" -
{
group
.
title
}
"
)
output_lines
.
append
(
f
" -
{
group
.
title
}
"
)
if
group
.
description
:
print
(
" "
+
group
.
description
.
strip
())
print
()
output_lines
.
append
(
" "
+
group
.
description
.
strip
())
output_lines
.
append
(
""
)
_output_with_pager
(
"
\n
"
.
join
(
output_lines
))
sys
.
exit
(
0
)
# For group search
...
...
@@ -229,7 +257,7 @@ def show_filtered_argument_or_group_from_help(parser: argparse.ArgumentParser,
formatter
.
add_text
(
group
.
description
)
formatter
.
add_arguments
(
group
.
_group_actions
)
formatter
.
end_section
()
print
(
formatter
.
format_help
())
_output_with_pager
(
formatter
.
format_help
())
sys
.
exit
(
0
)
# For single arg
...
...
@@ -243,10 +271,10 @@ def show_filtered_argument_or_group_from_help(parser: argparse.ArgumentParser,
matched_actions
.
append
(
action
)
if
matched_actions
:
print
(
f
"
\n
Parameters matching '
{
search_keyword
}
':
\n
"
)
header
=
f
"
\n
Parameters matching '
{
search_keyword
}
':
\n
"
formatter
=
parser
.
_get_formatter
()
formatter
.
add_arguments
(
matched_actions
)
print
(
formatter
.
format_help
())
_output_with_pager
(
header
+
formatter
.
format_help
())
sys
.
exit
(
0
)
print
(
f
"
\n
No group or parameter matching '
{
search_keyword
}
'"
)
...
...
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