@@ -130,6 +130,37 @@ var deviceShutdownCmd = &cobra.Command{
130130 },
131131}
132132
133+ var settingsCmd = & cobra.Command {
134+ Use : "settings" ,
135+ Short : "Device settings commands" ,
136+ Long : `Commands for applying device-level settings such as animations.` ,
137+ }
138+
139+ var settingsAnimations string
140+
141+ var settingsApplyCmd = & cobra.Command {
142+ Use : "apply" ,
143+ Short : "Apply device settings" ,
144+ Long : `Apply device-level settings. Example: mobilecli device settings apply --animations=off` ,
145+ RunE : func (cmd * cobra.Command , args []string ) error {
146+ req := commands.ApplySettingsRequest {
147+ DeviceID : deviceId ,
148+ }
149+
150+ if cmd .Flags ().Changed ("animations" ) {
151+ req .Animations = & settingsAnimations
152+ }
153+
154+ response := commands .ApplySettingsCommand (req )
155+ printJson (response )
156+ if response .Status == "error" {
157+ return fmt .Errorf ("%s" , response .Error )
158+ }
159+
160+ return nil
161+ },
162+ }
163+
133164func init () {
134165 rootCmd .AddCommand (deviceCmd )
135166
@@ -139,16 +170,22 @@ func init() {
139170 deviceCmd .AddCommand (deviceBootCmd )
140171 deviceCmd .AddCommand (deviceShutdownCmd )
141172 deviceCmd .AddCommand (orientationCmd )
173+ deviceCmd .AddCommand (settingsCmd )
142174
143175 // add orientation subcommands
144176 orientationCmd .AddCommand (orientationGetCmd )
145177 orientationCmd .AddCommand (orientationSetCmd )
146178
179+ // add settings subcommands
180+ settingsCmd .AddCommand (settingsApplyCmd )
181+
147182 // device command flags
148183 deviceRebootCmd .Flags ().StringVar (& deviceId , "device" , "" , "ID of the device to reboot" )
149184 deviceInfoCmd .Flags ().StringVar (& deviceId , "device" , "" , "ID of the device to get info from" )
150185 deviceBootCmd .Flags ().StringVar (& deviceId , "device" , "" , "ID of the device to boot" )
151186 deviceShutdownCmd .Flags ().StringVar (& deviceId , "device" , "" , "ID of the device to shutdown" )
152187 orientationGetCmd .Flags ().StringVar (& deviceId , "device" , "" , "ID of the device to get orientation from" )
153188 orientationSetCmd .Flags ().StringVar (& deviceId , "device" , "" , "ID of the device to set orientation on" )
189+ settingsApplyCmd .Flags ().StringVar (& deviceId , "device" , "" , "ID of the device to apply settings to" )
190+ settingsApplyCmd .Flags ().StringVar (& settingsAnimations , "animations" , "" , "Toggle system animations: 'on' or 'off'" )
154191}
0 commit comments