mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2025-01-17 18:11:30 +01:00
Add types, add missing MPL header that I skipped the check for
This commit is contained in:
parent
fde9a53624
commit
d2a1dc7de1
4 changed files with 17 additions and 12 deletions
|
@ -24,9 +24,6 @@ local function new_window(props)
|
|||
return props
|
||||
end
|
||||
|
||||
-- NOTE: these functions are duplicated here for documentation
|
||||
-- | and because I don't know of a better way
|
||||
|
||||
---Set a window's size.
|
||||
---@param size { w: integer?, h: integer? }
|
||||
function window:set_size(size)
|
||||
|
@ -130,6 +127,8 @@ function client.get_windows()
|
|||
},
|
||||
})
|
||||
|
||||
-- INFO: these read synchronously so this should always work IF the server works correctly
|
||||
|
||||
local window_props = ReadMsg().RequestResponse.response.GetAllWindows.windows
|
||||
---@type Window[]
|
||||
local windows = {}
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
-- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
-- file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
--
|
||||
-- SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
---@meta _
|
||||
|
||||
---@class _Msg
|
||||
|
|
|
@ -14,25 +14,26 @@ function process.spawn(command, callback)
|
|||
local callback_id = nil
|
||||
|
||||
if callback ~= nil then
|
||||
---@param args Args
|
||||
table.insert(CallbackTable, function(args)
|
||||
local args = args or {}
|
||||
local args = args.Spawn or {} -- don't know if the `or {}` is necessary
|
||||
callback(args.stdout, args.stderr, args.exit_code, args.exit_msg)
|
||||
end)
|
||||
callback_id = #CallbackTable
|
||||
end
|
||||
|
||||
local command_str = command
|
||||
local command = command
|
||||
if type(command_str) == "string" then
|
||||
command = {}
|
||||
for i in string.gmatch(command_str, "%S+") do
|
||||
table.insert(command, i)
|
||||
local command_arr = {}
|
||||
if type(command) == "string" then
|
||||
for i in string.gmatch(command, "%S+") do
|
||||
table.insert(command_arr, i)
|
||||
end
|
||||
else
|
||||
command_arr = command
|
||||
end
|
||||
|
||||
SendMsg({
|
||||
Spawn = {
|
||||
command = command,
|
||||
command = command_arr,
|
||||
callback_id = callback_id,
|
||||
},
|
||||
})
|
||||
|
|
|
@ -136,7 +136,6 @@ pub enum OutgoingMsg {
|
|||
}
|
||||
|
||||
#[derive(Debug, serde::Serialize, serde::Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum Args {
|
||||
/// Send a message with lines from the spawned process.
|
||||
Spawn {
|
||||
|
|
Loading…
Reference in a new issue