Add types, add missing MPL header that I skipped the check for

This commit is contained in:
Seaotatop 2023-06-26 21:19:02 -05:00
parent fde9a53624
commit d2a1dc7de1
4 changed files with 17 additions and 12 deletions

View file

@ -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 = {}

View file

@ -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

View file

@ -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,
},
})

View file

@ -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 {