mirror of
https://github.com/fluxionary/minetest-book_runner.git
synced 2025-03-21 15:21:22 +00:00
stylua
This commit is contained in:
parent
0e797a847d
commit
51451c97c8
4 changed files with 32 additions and 20 deletions
12
.github/workflows/pre-commit.yml
vendored
12
.github/workflows/pre-commit.yml
vendored
|
@ -2,7 +2,7 @@ name: pre-commit
|
||||||
on: [push, pull_request, workflow_dispatch]
|
on: [push, pull_request, workflow_dispatch]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
check:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
@ -12,11 +12,17 @@ jobs:
|
||||||
- name: install luarocks
|
- name: install luarocks
|
||||||
run: sudo apt-get install -y luarocks
|
run: sudo apt-get install -y luarocks
|
||||||
|
|
||||||
|
- name: add luarocks path
|
||||||
|
run: echo "$HOME/.luarocks/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: luacheck install
|
- name: luacheck install
|
||||||
run: luarocks install --local luacheck
|
run: luarocks install --local luacheck
|
||||||
|
|
||||||
- name: add luacheck path
|
- name: install cargo
|
||||||
run: echo "$HOME/.luarocks/bin" >> $GITHUB_PATH
|
run: sudo apt-get install -y cargo
|
||||||
|
|
||||||
|
- name: install stylua
|
||||||
|
run: cargo install stylua
|
||||||
|
|
||||||
- name: Install pre-commit
|
- name: Install pre-commit
|
||||||
run: pip3 install pre-commit
|
run: pip3 install pre-commit
|
||||||
|
|
|
@ -5,7 +5,6 @@ repos:
|
||||||
- id: fix-byte-order-marker
|
- id: fix-byte-order-marker
|
||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
|
|
||||||
- id: mixed-line-ending
|
- id: mixed-line-ending
|
||||||
args: [ --fix=lf ]
|
args: [ --fix=lf ]
|
||||||
|
|
||||||
|
@ -15,5 +14,12 @@ repos:
|
||||||
name: luacheck
|
name: luacheck
|
||||||
language: system
|
language: system
|
||||||
entry: luacheck
|
entry: luacheck
|
||||||
pass_filenames: false
|
pass_filenames: true
|
||||||
args: [-q,.]
|
types: [ file, lua ]
|
||||||
|
args: [ -q ]
|
||||||
|
- id: stylua
|
||||||
|
name: stylua
|
||||||
|
language: system
|
||||||
|
entry: stylua
|
||||||
|
pass_filenames: true
|
||||||
|
types: [ file, lua ]
|
||||||
|
|
19
command.lua
19
command.lua
|
@ -38,7 +38,6 @@ minetest.register_chatcommand("run_in_book", {
|
||||||
function minetest.chat_send_player(name2, message)
|
function minetest.chat_send_player(name2, message)
|
||||||
if name == name2 then
|
if name == name2 then
|
||||||
table.insert(received_messages, minetest.strip_colors(futil.strip_translation(message)))
|
table.insert(received_messages, minetest.strip_colors(futil.strip_translation(message)))
|
||||||
|
|
||||||
else
|
else
|
||||||
old_chat_send_player(name2, message)
|
old_chat_send_player(name2, message)
|
||||||
end
|
end
|
||||||
|
@ -53,14 +52,16 @@ minetest.register_chatcommand("run_in_book", {
|
||||||
|
|
||||||
local text = table.concat(received_messages, "\n")
|
local text = table.concat(received_messages, "\n")
|
||||||
local written_book = ItemStack("default:book_written")
|
local written_book = ItemStack("default:book_written")
|
||||||
written_book:get_meta():from_table({fields = {
|
written_book:get_meta():from_table({
|
||||||
title = param,
|
fields = {
|
||||||
owner = name,
|
title = param,
|
||||||
description = S("\"@1\" by @2", param, name),
|
owner = name,
|
||||||
text = text,
|
description = S('"@1" by @2', param, name),
|
||||||
page = 1,
|
text = text,
|
||||||
page_max = math.ceil((#text:gsub("[^\n]", "") + 1) / 14)
|
page = 1,
|
||||||
}})
|
page_max = math.ceil((#text:gsub("[^\n]", "") + 1) / 14),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
player:set_wielded_item(written_book)
|
player:set_wielded_item(written_book)
|
||||||
|
|
||||||
|
|
9
init.lua
9
init.lua
|
@ -3,29 +3,28 @@ local modpath = minetest.get_modpath(modname)
|
||||||
local S = minetest.get_translator(modname)
|
local S = minetest.get_translator(modname)
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
type(futil.version) == "number" and futil.version >= os.time({year = 2022, month = 10, day = 24}),
|
type(futil.version) == "number" and futil.version >= os.time({ year = 2022, month = 10, day = 24 }),
|
||||||
"please update futil"
|
"please update futil"
|
||||||
)
|
)
|
||||||
|
|
||||||
book_runner = {
|
book_runner = {
|
||||||
author = "flux",
|
author = "flux",
|
||||||
license = "AGPL_v3",
|
license = "AGPL_v3",
|
||||||
version = os.time({year = 2022, month = 9, day = 30}),
|
version = os.time({ year = 2022, month = 9, day = 30 }),
|
||||||
fork = "flux",
|
fork = "flux",
|
||||||
|
|
||||||
modname = modname,
|
modname = modname,
|
||||||
modpath = modpath,
|
modpath = modpath,
|
||||||
S = S,
|
S = S,
|
||||||
|
|
||||||
has = {
|
has = {},
|
||||||
},
|
|
||||||
|
|
||||||
log = function(level, messagefmt, ...)
|
log = function(level, messagefmt, ...)
|
||||||
return minetest.log(level, ("[%s] %s"):format(modname, messagefmt:format(...)))
|
return minetest.log(level, ("[%s] %s"):format(modname, messagefmt:format(...)))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
dofile = function(...)
|
dofile = function(...)
|
||||||
return dofile(table.concat({modpath, ...}, DIR_DELIM) .. ".lua")
|
return dofile(table.concat({ modpath, ... }, DIR_DELIM) .. ".lua")
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue