mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2025-01-30 20:34:49 +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
|
return props
|
||||||
end
|
end
|
||||||
|
|
||||||
-- NOTE: these functions are duplicated here for documentation
|
|
||||||
-- | and because I don't know of a better way
|
|
||||||
|
|
||||||
---Set a window's size.
|
---Set a window's size.
|
||||||
---@param size { w: integer?, h: integer? }
|
---@param size { w: integer?, h: integer? }
|
||||||
function window:set_size(size)
|
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
|
local window_props = ReadMsg().RequestResponse.response.GetAllWindows.windows
|
||||||
---@type Window[]
|
---@type Window[]
|
||||||
local windows = {}
|
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 _
|
---@meta _
|
||||||
|
|
||||||
---@class _Msg
|
---@class _Msg
|
||||||
|
|
|
@ -14,25 +14,26 @@ function process.spawn(command, callback)
|
||||||
local callback_id = nil
|
local callback_id = nil
|
||||||
|
|
||||||
if callback ~= nil then
|
if callback ~= nil then
|
||||||
|
---@param args Args
|
||||||
table.insert(CallbackTable, function(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)
|
callback(args.stdout, args.stderr, args.exit_code, args.exit_msg)
|
||||||
end)
|
end)
|
||||||
callback_id = #CallbackTable
|
callback_id = #CallbackTable
|
||||||
end
|
end
|
||||||
|
|
||||||
local command_str = command
|
local command_arr = {}
|
||||||
local command = command
|
if type(command) == "string" then
|
||||||
if type(command_str) == "string" then
|
for i in string.gmatch(command, "%S+") do
|
||||||
command = {}
|
table.insert(command_arr, i)
|
||||||
for i in string.gmatch(command_str, "%S+") do
|
|
||||||
table.insert(command, i)
|
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
command_arr = command
|
||||||
end
|
end
|
||||||
|
|
||||||
SendMsg({
|
SendMsg({
|
||||||
Spawn = {
|
Spawn = {
|
||||||
command = command,
|
command = command_arr,
|
||||||
callback_id = callback_id,
|
callback_id = callback_id,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -136,7 +136,6 @@ pub enum OutgoingMsg {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, serde::Serialize, serde::Deserialize)]
|
||||||
#[serde(untagged)]
|
|
||||||
pub enum Args {
|
pub enum Args {
|
||||||
/// Send a message with lines from the spawned process.
|
/// Send a message with lines from the spawned process.
|
||||||
Spawn {
|
Spawn {
|
||||||
|
|
Loading…
Add table
Reference in a new issue