Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runsc: Fix newline for cmd usage display #11330

Merged
merged 2 commits into from
Dec 30, 2024
Merged

Conversation

copybara-service[bot]
Copy link

runsc: Fix newline for cmd usage display

Summary

Originally, some of the commands' usage display didn't achieved to show newline, while some of them does, which are more user-friendly, and won't confuse the message if there're more which should be in the nextline.

Fix this issue by returning usage string with a newline.

Tests

Before the change some commands display their usage like the following, for example runsc start

vax-r@vaxr-ASUSPRO-D840MB-M840MB:~/gvisor$ runsc start
start <container id> - start a secure container.vax-r@vaxr-ASUSPRO-D840MB-M840MB:~/gvisor$

Or runsc wait

vax-r@vaxr-ASUSPRO-D840MB-M840MB:~/gvisor$ runsc wait
wait [flags] <container id>  -checkpoint
    	wait for the next checkpoint to complete
  -pid int
    	select a PID in the container's PID namespace to wait on instead of the container's root process (default -1)
  -rootpid int
    	select a PID in the sandbox root PID namespace to wait on instead of the container's root process (default -1)

We can see in the case of runsc wait, the flag -checkpoint is expected to be shown in a way which is aligned with other flags, like

vax-r@vaxr-ASUSPRO-D840MB-M840MB:~/gvisor$ runsc wait
wait [flags] <container id>  
  -checkpoint
    	wait for the next checkpoint to complete
  -pid int
    	select a PID in the container's PID namespace to wait on instead of the container's root process (default -1)
  -rootpid int
    	select a PID in the sandbox root PID namespace to wait on instead of the container's root process (default -1)

After the change , we can see those commands with this issue are being fixed.

vax-r@vaxr-ASUSPRO-D840MB-M840MB:~/gvisor$ runsc start
start <container id> - start a secure container.
vax-r@vaxr-ASUSPRO-D840MB-M840MB:~/gvisor$
vax-r@vaxr-ASUSPRO-D840MB-M840MB:~/gvisor$ runsc wait
wait [flags] <container id>
  -checkpoint
    	wait for the next checkpoint to complete
  -pid int
    	select a PID in the container's PID namespace to wait on instead of the container's root process (default -1)
  -rootpid int
    	select a PID in the sandbox root PID namespace to wait on instead of the container's root process (default -1)

FUTURE_COPYBARA_INTEGRATE_REVIEW=#11324 from vax-r:fix_usage_display 83f9f18

Originally, some of the commands' usage display didn't achieved to show
newline, while some of them does, which are more user-friendly, and
won't confuse the message if there're more which should be in the
nextline.

Fix this issue by returning usage string with a newline.

Signed-off-by: I Hsin Cheng <richard120310@gmail.com>
@copybara-service copybara-service bot added the exported Issue was exported automatically label Dec 30, 2024
@copybara-service copybara-service bot merged commit 1db44ea into master Dec 30, 2024
0 of 2 checks passed
@copybara-service copybara-service bot deleted the test/cl710756149 branch December 30, 2024 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exported Issue was exported automatically
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants