Skip to content

Commit 9be601b

Browse files
committed
added scrcpy
1 parent 4153ccc commit 9be601b

File tree

2 files changed

+181
-0
lines changed

2 files changed

+181
-0
lines changed

Diff for: completers/scrcpy_completer/cmd/root.go

+174
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var rootCmd = &cobra.Command{
9+
Use: "scrcpy",
10+
Short: "Display and control your Android device",
11+
Long: "https://github.com/Genymobile/scrcpy",
12+
Run: func(cmd *cobra.Command, args []string) {},
13+
}
14+
15+
func Execute() error {
16+
return rootCmd.Execute()
17+
}
18+
func init() {
19+
carapace.Gen(rootCmd).Standalone()
20+
21+
rootCmd.Flags().BoolS("G", "G", false, "Same as --gamepad=uhid, or --keyboard=aoa if --otg is set")
22+
rootCmd.Flags().BoolS("K", "K", false, "Same as --keyboard=uhid, or --keyboard=aoa if --otg is set.")
23+
rootCmd.Flags().BoolS("M", "M", false, "Same as --mouse=uhid, or --mouse=aoa if --otg is set")
24+
rootCmd.Flags().Bool("always-on-top", false, "Make scrcpy window always on top")
25+
rootCmd.Flags().String("angle", "", "Rotate the video content by a custom angle")
26+
rootCmd.Flags().String("audio-bit-rate", "", "Encode the audio at the given bit rate")
27+
rootCmd.Flags().String("audio-buffer", "", "Configure the audio buffering delay")
28+
rootCmd.Flags().String("audio-codec", "", "Select an audio codec")
29+
rootCmd.Flags().String("audio-codec-options", "", "Set options for the device audio encoder")
30+
rootCmd.Flags().Bool("audio-dup", false, "Duplicate audio")
31+
rootCmd.Flags().String("audio-encoder", "", "Use a specific MediaCodec audio encoder")
32+
rootCmd.Flags().Bool("audio-output-buffer", false, "ms Configure the size of the SDL audio output buffer")
33+
rootCmd.Flags().String("audio-source", "", "Select the audio source")
34+
rootCmd.Flags().String("camera-ar", "", "Select the camera size by its aspect ratio")
35+
rootCmd.Flags().String("camera-facing", "", "Select the device camera by its facing direction")
36+
rootCmd.Flags().String("camera-fps", "", "Specify the camera capture frame rate")
37+
rootCmd.Flags().Bool("camera-high-speed", false, "Enable high-speed camera capture mode")
38+
rootCmd.Flags().String("camera-id", "", "Specify the device camera id to mirror")
39+
rootCmd.Flags().String("camera-size", "", "Specify an explicit camera capture size")
40+
rootCmd.Flags().String("capture-orientation", "", "Specify capture orientation")
41+
rootCmd.Flags().String("crop", "", "Crop the device screen on the server")
42+
rootCmd.Flags().Bool("disable-screensaver", false, "Disable screensaver while scrcpy is running")
43+
rootCmd.Flags().String("display-id", "", "Specify the device display id to mirror")
44+
rootCmd.Flags().String("display-orientation", "", "Set the initial display orientation")
45+
rootCmd.Flags().Bool("force-adb-forward", false, "Do not attempt to use \"adb reverse\" to connect to the device")
46+
rootCmd.Flags().BoolP("fullscreen", "f", false, "Start in fullscreen")
47+
rootCmd.Flags().String("gamepad", "", "Select how to send gamepad inputs to the device")
48+
rootCmd.Flags().BoolP("help", "h", false, "Print help")
49+
rootCmd.Flags().String("keyboard", "", "Select how to send keyboard inputs to the device")
50+
rootCmd.Flags().Bool("kill-adb-on-close", false, "Kill adb when scrcpy terminates")
51+
rootCmd.Flags().Bool("legacy-paste", false, "Inject computer clipboard text as a sequence of key events on Ctrl+v")
52+
rootCmd.Flags().Bool("list-apps", false, "List Android apps installed on the device")
53+
rootCmd.Flags().Bool("list-camera-sizes", false, "List the valid camera capture sizes")
54+
rootCmd.Flags().Bool("list-cameras", false, "List cameras available on the device")
55+
rootCmd.Flags().Bool("list-displays", false, "List displays available on the device")
56+
rootCmd.Flags().Bool("list-encoders", false, "List video and audio encoders available on the device")
57+
rootCmd.Flags().String("max-fps", "", "Limit the framerate of screen capture")
58+
rootCmd.Flags().StringP("max-size", "m", "", "Limit both the width and height of the video to value")
59+
rootCmd.Flags().String("mouse", "", "Select how to send mouse inputs to the device")
60+
rootCmd.Flags().String("mouse-bind", "", "Configure bindings of secondary clicks")
61+
rootCmd.Flags().String("new-display", "", "Create a new display with the specified resolution and density")
62+
rootCmd.Flags().Bool("no-audio", false, "Disable audio forwarding")
63+
rootCmd.Flags().Bool("no-audio-playback", false, "Disable audio playback on the computer")
64+
rootCmd.Flags().Bool("no-cleanup", false, "Do not restore the device state")
65+
rootCmd.Flags().Bool("no-clipboard-autosync", false, "Do not automatically synchronizes the computer clipboard")
66+
rootCmd.Flags().BoolP("no-control", "n", false, "Disable device control")
67+
rootCmd.Flags().Bool("no-downsize-on-error", false, "Do no automatically try again with a lower definition")
68+
rootCmd.Flags().Bool("no-key-repeat", false, "Do not forward repeated key events when a key is held down")
69+
rootCmd.Flags().Bool("no-mipmaps", false, "Disables the generation of mipmaps")
70+
rootCmd.Flags().Bool("no-mouse-hover", false, "Do not forward mouse hover events")
71+
rootCmd.Flags().BoolP("no-playback", "N", false, "Disable video and audio playback on the computer")
72+
rootCmd.Flags().Bool("no-power-on", false, "Do not power on the device on start")
73+
rootCmd.Flags().Bool("no-vd-system-decorations", false, "Disable virtual display system decorations flag")
74+
rootCmd.Flags().Bool("no-video", false, "Disable video forwarding")
75+
rootCmd.Flags().Bool("no-video-playback", false, "Disable video playback on the computer")
76+
rootCmd.Flags().Bool("no-window", false, "Disable scrcpy window")
77+
rootCmd.Flags().String("orientation", "", "Same as --display-orientation=value --record-orientation=value")
78+
rootCmd.Flags().Bool("otg", false, "Run in OTG mode")
79+
rootCmd.Flags().String("pause-on-exit", "", "Configure pause on exit")
80+
rootCmd.Flags().StringP("port", "p", "", "Set the TCP port (range) used by the client to listen")
81+
rootCmd.Flags().Bool("power-off-on-close", false, "Turn the device screen off when closing scrcpy")
82+
rootCmd.Flags().Bool("prefer-text", false, "Inject alpha characters and space as text events instead of key events")
83+
rootCmd.Flags().Bool("print-fps", false, "Start FPS counter")
84+
rootCmd.Flags().String("push-target", "", "Set the target directory for pushing files")
85+
rootCmd.Flags().Bool("raw-key-events", false, "Inject key events for all input keys, and ignore text events")
86+
rootCmd.Flags().StringP("record", "r", "", "Record screen to file")
87+
rootCmd.Flags().String("record-format", "", "Force recording format")
88+
rootCmd.Flags().String("record-orientation", "", "Set the record orientation")
89+
rootCmd.Flags().String("render-driver", "", "Request SDL to use the given render driver")
90+
rootCmd.Flags().Bool("require-audio", false, "Fail if audio is enabled but does not work")
91+
rootCmd.Flags().BoolP("select-tcpip", "e", false, "Use TCP/IP device")
92+
rootCmd.Flags().BoolP("select-usb", "d", false, "Use USB device")
93+
rootCmd.Flags().StringP("serial", "s", "", "The device serial number")
94+
rootCmd.Flags().String("shortcut-mod", "", "Specify the modifiers to use for scrcpy shortcuts")
95+
rootCmd.Flags().BoolP("show-touches", "t", false, "Enable \"show touches\" on start")
96+
rootCmd.Flags().String("start-app", "", "Start an Android app, by its exact package name")
97+
rootCmd.Flags().BoolP("stay-awake", "w", false, "Keep the device on while scrcpy is running")
98+
rootCmd.Flags().String("tcpip", "", "Configure and reconnect the device over TCP/IP")
99+
rootCmd.Flags().String("time-limit", "", "Set the maximum mirroring time")
100+
rootCmd.Flags().String("tunnel-host", "", "Set the IP address of the adb tunnel to reach the scrcpy server")
101+
rootCmd.Flags().String("tunnel-port", "", "Set the TCP port of the adb tunnel to reach the scrcpy server")
102+
rootCmd.Flags().BoolP("turn-screen-off", "S", false, "Turn the device screen off immediately")
103+
rootCmd.Flags().String("v4l2-buffer", "", "Add a buffering delay before pushing frames")
104+
rootCmd.Flags().String("v4l2-sink", "", "Output to v4l2loopback device")
105+
rootCmd.Flags().StringP("verbosity", "V", "", "Set the log level")
106+
rootCmd.Flags().BoolP("version", "v", false, "Print the version of scrcpy")
107+
rootCmd.Flags().StringP("video-bit-rate", "b", "", "Encode the video at the given bit rate")
108+
rootCmd.Flags().String("video-buffer", "", "Add a buffering delay before displaying video frames")
109+
rootCmd.Flags().String("video-codec", "", "Select a video codec")
110+
rootCmd.Flags().String("video-codec-options", "", "Set a list of options for the device video encoder")
111+
rootCmd.Flags().String("video-encoder", "", "Use a specific MediaCodec video encoder")
112+
rootCmd.Flags().String("video-source", "", "Select the video source")
113+
rootCmd.Flags().Bool("window-borderless", false, "Disable window decorations")
114+
rootCmd.Flags().String("window-height", "", "Set the initial window height")
115+
rootCmd.Flags().String("window-title", "", "Set a custom window title")
116+
rootCmd.Flags().String("window-width", "", "Set the initial window width")
117+
rootCmd.Flags().String("window-x", "", "Set the initial window horizontal position")
118+
rootCmd.Flags().String("window-y", "", "Set the initial window vertical position")
119+
120+
carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
121+
"angle": carapace.ActionValues(),
122+
"audio-bit-rate": carapace.ActionValues(),
123+
"audio-buffer": carapace.ActionValues(),
124+
"audio-codec": carapace.ActionValues(),
125+
"audio-codec-options": carapace.ActionValues(),
126+
"audio-encoder": carapace.ActionValues(),
127+
"audio-source": carapace.ActionValues(),
128+
"camera-ar": carapace.ActionValues(),
129+
"camera-facing": carapace.ActionValues(),
130+
"camera-fps": carapace.ActionValues(),
131+
"camera-id": carapace.ActionValues(),
132+
"camera-size": carapace.ActionValues(),
133+
"capture-orientation": carapace.ActionValues(),
134+
"crop": carapace.ActionValues(),
135+
"display-id": carapace.ActionValues(),
136+
"display-orientation": carapace.ActionValues(),
137+
"gamepad": carapace.ActionValues(),
138+
"keyboard": carapace.ActionValues(),
139+
"max-fps": carapace.ActionValues(),
140+
"max-size": carapace.ActionValues(),
141+
"mouse": carapace.ActionValues(),
142+
"mouse-bind": carapace.ActionValues(),
143+
"new-display": carapace.ActionValues(),
144+
"orientation": carapace.ActionValues(),
145+
"pause-on-exit": carapace.ActionValues(),
146+
"port": carapace.ActionValues(),
147+
"push-target": carapace.ActionValues(),
148+
"record": carapace.ActionValues(),
149+
"record-format": carapace.ActionValues(),
150+
"record-orientation": carapace.ActionValues(),
151+
"render-driver": carapace.ActionValues(),
152+
"serial": carapace.ActionValues(),
153+
"shortcut-mod": carapace.ActionValues(),
154+
"start-app": carapace.ActionValues(),
155+
"tcpip": carapace.ActionValues(),
156+
"time-limit": carapace.ActionValues(),
157+
"tunnel-host": carapace.ActionValues(),
158+
"tunnel-port": carapace.ActionValues(),
159+
"v4l2-buffer": carapace.ActionValues(),
160+
"v4l2-sink": carapace.ActionValues(),
161+
"verbosity": carapace.ActionValues(),
162+
"video-bit-rate": carapace.ActionValues(),
163+
"video-buffer": carapace.ActionValues(),
164+
"video-codec": carapace.ActionValues(),
165+
"video-codec-options": carapace.ActionValues(),
166+
"video-encoder": carapace.ActionValues(),
167+
"video-source": carapace.ActionValues(),
168+
"window-height": carapace.ActionValues(),
169+
"window-title": carapace.ActionValues(),
170+
"window-width": carapace.ActionValues(),
171+
"window-x": carapace.ActionValues(),
172+
"window-y": carapace.ActionValues(),
173+
})
174+
}

Diff for: completers/scrcpy_completer/main.go

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package main
2+
3+
import "github.com/carapace-sh/carapace-bin/completers/scrcpy_completer/cmd"
4+
5+
func main() {
6+
cmd.Execute()
7+
}

0 commit comments

Comments
 (0)