Skip to content

Commit

Permalink
feat: added XcodebuildOpenInXcode command
Browse files Browse the repository at this point in the history
  • Loading branch information
wojciech-kulik committed Feb 16, 2024
1 parent 55034d5 commit 4c608d8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ Xcodebuild.nvim comes with the following commands:
| `XcodebuildToggleLogs` | Toggle logs panel |
| `XcodebuildOpenLogs` | Open logs panel |
| `XcodebuildCloseLogs` | Close logs panel |
| `XcodebuildOpenInXcode` | Open project in Xcode |

### Project Manager

Expand Down
6 changes: 6 additions & 0 deletions lua/xcodebuild/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ local function update_settings(callback)
end)
end

function M.open_in_xcode()
if helpers.validate_project() then
vim.fn.system({ "open", projectConfig.settings.projectFile })
end
end

function M.open_logs()
logs.open_logs(false)
end
Expand Down
1 change: 1 addition & 0 deletions lua/xcodebuild/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ function M.setup(options)
vim.api.nvim_create_user_command("XcodebuildBootSimulator", call(actions.boot_simulator), { nargs = 0 })
vim.api.nvim_create_user_command("XcodebuildCleanDerivedData", call(actions.clean_derived_data), { nargs = 0 })
vim.api.nvim_create_user_command("XcodebuildUninstall", call(actions.uninstall), { nargs = 0 })
vim.api.nvim_create_user_command("XcodebuildOpenInXcode", call(actions.open_in_xcode), { nargs = 0 })
end

return M
2 changes: 2 additions & 0 deletions lua/xcodebuild/pickers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ function M.show_all_actions()
"Boot Selected Simulator",
"Clean DerivedData",
"Uninstall Application",
"Open Project in Xcode",
}
local actionsPointers = {
actions.build,
Expand Down Expand Up @@ -458,6 +459,7 @@ function M.show_all_actions()
actions.boot_simulator,
actions.clean_derived_data,
actions.uninstall,
actions.open_in_xcode,
}

if not projectConfig.is_project_configured() then
Expand Down

0 comments on commit 4c608d8

Please sign in to comment.