Skip to content

Commit

Permalink
Step init (#1)
Browse files Browse the repository at this point in the history
* Step init

* Add e2e test

* Fix lint issues

* Add missing e2e test workflow

* Rename e2e test workflow

* Remove unused consts

* Use debug log level for device finder logs

* is_dont_change_value for iphonesimulator_preferences_pth
  • Loading branch information
godrei authored Nov 8, 2024
1 parent ee327c1 commit ef0f68a
Show file tree
Hide file tree
Showing 149 changed files with 34,394 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.bitrise*
.idea
.vscode
README.md.backup
_tmp/
.env
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2024 bitrise-steplib

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
46 changes: 45 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,45 @@
# steps-disable-iphonesimulator-connect-hardware-keyboard
# Disable iphonesimulator ConnectHardwareKeyboard preference

[![Step changelog](https://shields.io/github/v/release/bitrise-steplib/steps-disable-iphonesimulator-connect-hardware-keyboard?include_prereleases&label=changelog&color=blueviolet)](https://github.com/bitrise-steplib/steps-disable-iphonesimulator-connect-hardware-keyboard/releases)

This Step disables ConnectHardwareKeyboard preference for all iphonesimulator devices.


<details>
<summary>Description</summary>

<nil>
</details>

## 🧩 Get started

Add this step directly to your workflow in the [Bitrise Workflow Editor](https://devcenter.bitrise.io/steps-and-workflows/steps-and-workflows-index/).

You can also run this step directly with [Bitrise CLI](https://github.com/bitrise-io/bitrise).

## ⚙️ Configuration

<details>
<summary>Inputs</summary>

| Key | Description | Flags | Default |
| --- | --- | --- | --- |
| `iphonesimulator_preferences_pth` | The path of the iphonesimulator preferences file. | required | `~/Library/Preferences/com.apple.iphonesimulator.plist` |
| `verbose` | Print verbose information. | required | `no` |
</details>

<details>
<summary>Outputs</summary>
There are no outputs defined in this step
</details>

## 🙋 Contributing

We welcome [pull requests](https://github.com/bitrise-steplib/steps-disable-iphonesimulator-connect-hardware-keyboard/pulls) and [issues](https://github.com/bitrise-steplib/steps-disable-iphonesimulator-connect-hardware-keyboard/issues) against this repository.

For pull requests, work on your changes in a forked repository and use the Bitrise CLI to [run step tests locally](https://devcenter.bitrise.io/bitrise-cli/run-your-first-build/).

Learn more about developing steps:

- [Create your own step](https://devcenter.bitrise.io/contributors/create-your-own-step/)
- [Testing your Step](https://devcenter.bitrise.io/contributors/testing-and-versioning-your-steps/)
34 changes: 34 additions & 0 deletions bitrise.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
format_version: "11"
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git

app:
envs:
- EXAMPLE_IPHONESIMULATOR_PREFERENCES_PATH: $BITRISE_SOURCE_DIR/simpref/testdata/com.apple.iphonesimulator.plist

workflows:
check:
steps:
- git::https://github.com/bitrise-steplib/steps-check.git: { }

e2e:
steps:
- git::https://github.com/bitrise-steplib/steps-check.git:
inputs:
- workflow: e2e

sample:
steps:
- change-workdir:
title: Switch working dir to test / _tmp dir
inputs:
- path: ./_tmp
- is_create_path: true
- path::./:
title: Step Test
inputs:
- iphonesimulator_preferences_pth: $EXAMPLE_IPHONESIMULATOR_PREFERENCES_PATH
- verbose: "yes"

generate_readme:
steps:
- git::https://github.com/bitrise-steplib/steps-readme-generator.git@main: { }
53 changes: 53 additions & 0 deletions e2e/bitrise.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
format_version: "11"
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git

workflows:
test_disable_hardware_keyboard:
steps:
- script:
title: Create test simulator preferences file
inputs:
- content: |-
#!/bin/bash
set -ex
rm -rf "./_tmp"
mkdir -p "./_tmp"
cat <<EOF > ./_tmp/com.apple.iphonesimulator.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DevicePreferences</key>
<dict>
<key>D354CF33-5030-436B-B42E-0A260531432E</key>
<dict>
</dict>
</dict>
</dict>
</plist>
EOF
envman add --key TEST_IPHONESIMULATOR_PREFERENCES_PATH --value ./_tmp/com.apple.iphonesimulator.plist
- path::./:
title: Execute step
inputs:
- iphonesimulator_preferences_pth: $TEST_IPHONESIMULATOR_PREFERENCES_PATH
- verbose: "yes"
- script:
title: Verify hardware keyboard is disabled
inputs:
- content: |-
#!/bin/bash
set -ex
simulator_prefs_content=$(cat $TEST_IPHONESIMULATOR_PREFERENCES_PATH)
expected_content='<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict><key>ConnectHardwareKeyboard</key><string>0</string><key>DevicePreferences</key><dict><key>D354CF33-5030-436B-B42E-0A260531432E</key><dict><key>ConnectHardwareKeyboard</key><false/></dict></dict></dict></plist>'
if [ "$simulator_prefs_content" != "$expected_content" ]; then
echo "Simulator preferences content does not match the expected content"
exit 1
fi
21 changes: 21 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module github.com/bitrise-steplib/steps-disable-iphonesimulator-connect-hardware-keyboard

go 1.22.7

require (
github.com/bitrise-io/go-plist v0.0.0-20210301100253-4b1a112ccd10
github.com/bitrise-io/go-steputils/v2 v2.0.0-alpha.35
github.com/bitrise-io/go-utils v1.0.13
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.23
github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.49
github.com/stretchr/testify v1.9.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
68 changes: 68 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
github.com/bitrise-io/go-plist v0.0.0-20210301100253-4b1a112ccd10 h1:/2OyBFI7GjYKexBPcfTPvKFz8Ks7qYzkkz2SQ8aiJgc=
github.com/bitrise-io/go-plist v0.0.0-20210301100253-4b1a112ccd10/go.mod h1:pARutiL3kEuRLV3JvswidvfCj+9Y3qMZtji2BDqLFsA=
github.com/bitrise-io/go-steputils/v2 v2.0.0-alpha.35 h1:P1tpwLnmZ1v1zKlP+VaRqD7iM2M4PGmzwXclfaX56dA=
github.com/bitrise-io/go-steputils/v2 v2.0.0-alpha.35/go.mod h1:EiSwIs7eqfddVHxEvCIdQdvc7+/HeIy15fYy486n/vE=
github.com/bitrise-io/go-utils v1.0.13 h1:1QENhTS/JlKH9F7+/nB+TtbTcor6jGrE6cQ4CJWfp5U=
github.com/bitrise-io/go-utils v1.0.13/go.mod h1:ZY1DI+fEpZuFpO9szgDeICM4QbqoWVt0RSY3tRI1heY=
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.23 h1:Dfh4nyZPuEtilBisidejqxBrkx9cWvbOUrpq8VEION0=
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.23/go.mod h1:3XUplo0dOWc3DqT2XA2SeHToDSg7+j1y1HTHibT2H68=
github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.49 h1:2nk27mw86WZFXGKAERVMtU4CMeRd+X4m+5oFLyZrMDg=
github.com/bitrise-io/go-xcode/v2 v2.0.0-alpha.49/go.mod h1:KpxSPrRLgY0fscSajOyO/5h7MhapsqnSJr17oXEaPsg=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k=
github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
github.com/hashicorp/go-retryablehttp v0.7.0/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU=
github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk=
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
golang.org/x/crypto v0.0.0-20211202192323-5770296d904e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
69 changes: 69 additions & 0 deletions logger.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package main

import "github.com/bitrise-io/go-utils/v2/log"

type deviceFinderLogger struct {
logger log.Logger
}

func newDeviceFinderLogger(logger log.Logger) log.Logger {
return deviceFinderLogger{
logger: logger,
}
}

func (l deviceFinderLogger) Infof(format string, v ...interface{}) {
l.logger.Debugf(format, v...)
}

func (l deviceFinderLogger) Warnf(format string, v ...interface{}) {
l.logger.Debugf(format, v...)
}

func (l deviceFinderLogger) Printf(format string, v ...interface{}) {
l.logger.Debugf(format, v...)
}

func (l deviceFinderLogger) Donef(format string, v ...interface{}) {
l.logger.Debugf(format, v...)
}

func (l deviceFinderLogger) Debugf(format string, v ...interface{}) {
l.logger.Debugf(format, v...)
}

func (l deviceFinderLogger) Errorf(format string, v ...interface{}) {
l.logger.Debugf(format, v...)
}

func (l deviceFinderLogger) TInfof(format string, v ...interface{}) {
l.logger.TDebugf(format, v...)
}

func (l deviceFinderLogger) TWarnf(format string, v ...interface{}) {
l.logger.TDebugf(format, v...)
}

func (l deviceFinderLogger) TPrintf(format string, v ...interface{}) {
l.logger.TDebugf(format, v...)
}

func (l deviceFinderLogger) TDonef(format string, v ...interface{}) {
l.logger.TDebugf(format, v...)
}

func (l deviceFinderLogger) TDebugf(format string, v ...interface{}) {
l.logger.TDebugf(format, v...)
}

func (l deviceFinderLogger) TErrorf(format string, v ...interface{}) {
l.logger.TDebugf(format, v...)
}

func (l deviceFinderLogger) Println() {
l.logger.Debugf("")
}

func (l deviceFinderLogger) EnableDebugLog(enable bool) {
l.logger.EnableDebugLog(enable)
}
67 changes: 67 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package main

import (
"fmt"
"os"

"github.com/bitrise-io/go-steputils/v2/stepconf"
"github.com/bitrise-io/go-utils/v2/command"
"github.com/bitrise-io/go-utils/v2/env"
"github.com/bitrise-io/go-utils/v2/fileutil"
"github.com/bitrise-io/go-utils/v2/log"
"github.com/bitrise-io/go-utils/v2/pathutil"
"github.com/bitrise-io/go-xcode/v2/destination"
"github.com/bitrise-io/go-xcode/v2/xcodeversion"
"github.com/bitrise-steplib/steps-disable-iphonesimulator-connect-hardware-keyboard/simpref"
)

type Inputs struct {
IPhoneSimulatorPreferencesPth string `env:"iphonesimulator_preferences_pth,required"`
Verbose bool `env:"verbose,opt[yes,no]"`
}

func main() {
logger := log.NewLogger()

var inputs Inputs
if err := stepconf.NewInputParser(env.NewRepository()).Parse(&inputs); err != nil {
logger.Errorf("Failed to parse inputs: %s", err)
os.Exit(1)
}
stepconf.Print(inputs)

logger.EnableDebugLog(inputs.Verbose)

envRepository := env.NewRepository()
commandFactory := command.NewFactory(envRepository)
xcodebuildVersionProvider := xcodeversion.NewXcodeVersionProvider(commandFactory)
xcodeVersion, err := xcodebuildVersionProvider.GetVersion()
if err != nil { // not fatal error, continuing with empty version
logger.Warnf("failed to read Xcode version: %s", err)
}
deviceFinder := destination.NewDeviceFinder(newDeviceFinderLogger(logger), commandFactory, xcodeVersion)
pathModifier := pathutil.NewPathModifier()
fileManager := fileutil.NewFileManager()

if err := disableConnectHardwareKeyboard(inputs.IPhoneSimulatorPreferencesPth, deviceFinder, pathModifier, fileManager, logger); err != nil {
logger.Errorf("Failed to disable iPhone Simulator Connect Hardware Keyboard: %s", err)
os.Exit(1)
}
}

func disableConnectHardwareKeyboard(pth string, deviceFinder destination.DeviceFinder, pathModifier pathutil.PathModifier, fileManager fileutil.FileManager, logger log.Logger) error {
logger.Println()
logger.Infof("Dsiabling iPhone Simulator Connect Hardware Keyboard in preferences: %s", pth)

prefs, err := simpref.OpenIPhoneSimulatorPreferences(pth, deviceFinder, pathModifier, fileManager, logger)
if err != nil {
return fmt.Errorf("failed to open preferences: %s", err)
}

if err := prefs.DisableConnectHardwareKeyboard(); err != nil {
return err
}

logger.Infof("Connect Hardware Keyboard disabled")
return nil
}
Loading

0 comments on commit ef0f68a

Please sign in to comment.