Skip to content

Commit

Permalink
Removed all trailing whitespaces from OpenOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
Possseidon authored and asiekierka committed Jun 3, 2023
1 parent c053c0f commit 3831a86
Show file tree
Hide file tree
Showing 32 changed files with 63 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if #args < 2 or options.h then
end

-- clean options for copy (as opposed to move)
options =
options =
{
cmd = "cp",
i = options.i,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pcall(function()
io.write(" " .. tostring(evt[i]))
end
end

io.write("\n")
until evt[1] == "interrupted"
end)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ local function formatSize(size)
unit = unit + 1
size = size / power
end

return math.floor(size * 10) / 10 .. sizes[unit]
end

Expand All @@ -90,7 +90,7 @@ local function visitor(rpath)
subtotal = subtotal + vtotal
dirs = dirs + vdirs
end

if dirs == 0 then -- no child dirs
if not bSummary then
printSize(subtotal, rpath)
Expand All @@ -113,7 +113,7 @@ for i,arg in ipairs(args) do
else
if fs.isDirectory(path) then
local total = visitor(arg)

if bSummary then
printSize(total, arg)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ local function uncut()
for _, line in ipairs(cutBuffer) do
insert(line)
enter()
end
end
end

-------------------------------------------------------------------------------
Expand Down
18 changes: 9 additions & 9 deletions src/main/resources/assets/opencomputers/loot/openos/bin/find.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ local shell = require("shell")
local fs = require("filesystem")
local text = require("text")

local USAGE =
local USAGE =
[===[Usage: find [path] [--type=[dfs]] [--[i]name=EXPR]
--path if not specified, path is assumed to be current working directory
--type returns results of a given type, d:directory, f:file, and s:symlinks
--name specify the file name pattern. Use quote to include *. iname is
--name specify the file name pattern. Use quote to include *. iname is
case insensitive
--help display this help and exit]===]

Expand Down Expand Up @@ -74,31 +74,31 @@ if options.iname or options.name then
-- prefix any * with . for gnu find glob matching
fileNamePattern = text.escapeMagic(fileNamePattern)
fileNamePattern = fileNamePattern:gsub("%%%*", ".*")
end
end

local function isValidType(spath)
if not fs.exists(spath) then
return false
end

if fileNamePattern:len() > 0 then
local fileName = spath:gsub('.*/','')

if fileName:len() == 0 then
return false
end

local caseFileName = fileName

if not bCaseSensitive then
caseFileName = caseFileName:lower()
end

local s, e = caseFileName:find(fileNamePattern)
if not s or not e then
return false
end

if s ~= 1 or e ~= caseFileName:len() then
return false
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ local prefix = args[1] or os.getenv("TMPDIR") .. '/'
if not fs.exists(prefix) then
io.stderr:write(
string.format(
"cannot create tmp file or directory at %s, it does not exist\n",
"cannot create tmp file or directory at %s, it does not exist\n",
prefix))
return 1
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ end
local function print_mounts()
-- for each mount
local mounts = {}

for proxy,path in fs.mounts() do
local device = {}

Expand All @@ -56,7 +56,7 @@ local function print_mounts()
for _,device in ipairs(dev_mounts) do
local rw_ro = "(" .. device.rw_ro .. ")"
local fs_label = "\"" .. device.fs_label .. "\""

io.write(string.format("%-8s on %-10s %s %s\n",
dev_path:sub(1,8),
device.mount_path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if #args < 2 or options.h then
end

-- clean options for move (as opposed to copy)
options =
options =
{
cmd = "mv",
f = options.f,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ local function saveConfig(conf)
for key, value in pairs(conf) do
file:write(tostring(key) .. " = " .. require("serialization").serialize(value) .. "\n")
end

file:close()
return true
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if #args < 1 then
io.write(k .. "='" .. string.gsub(v, "'", [['"'"']]) .. "'\n")
end
else
local count = 0
local count = 0
for _, expr in ipairs(args) do
local e = expr:find('=')
if e then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ end

local lines = file:lines()

while true do
while true do
local line = lines()
if not line then
break
end
local current_data = process.info().data

local source_proc = process.load((assert(os.getenv("SHELL"), "no $SHELL set")))
local source_data = process.list[source_proc].data
source_data.aliases = current_data.aliases -- hacks to propogate sub shell env changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local sh = require('sh')
local real_before, cpu_before = computer.uptime(), os.clock()
local cmd_result = 0
if ... then
sh.execute(nil, ...)
sh.execute(nil, ...)
cmd_result = sh.getLastExitCode()
end
local real_after, cpu_after = computer.uptime(), os.clock()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ if result then
if not options.q then
io.write("success.\n")
end

if f then
f:close()
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ end

for i = 1, #args do
local result, reason = shell.resolve(args[i], "lua")

if not result then
result = shell.getAlias(args[i])
if result then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local colors = {
[0] = "white",
[0] = "white",
[1] = "orange",
[2] = "magenta",
[3] = "lightblue",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function core_cursor.vertical:echo(arg, num)
return
end
local out = io.stdin.stream

if not gpu then return end
win.nowrap = self.nowrap
if arg == "" then -- special scroll request
Expand Down Expand Up @@ -215,7 +215,7 @@ function core_cursor.read(cursor)
if #last > 0 then
cursor:handle("clipboard", last)
end

-- address checks
local address_check =
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
return
{
eeprom =
eeprom =
{
link = "components/by-type/eeprom/0/contents",
isAvailable = function()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function core_cursor.tab(cursor)
end

local cache = cursor.cache

if #cache == 1 and cache.i == 0 then
-- there was only one solution, and the user is asking for the next
cursor.cache = hints(cache[1], cursor.index + 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ function sh.internal.glob(eword)

local segments = text.split(glob_pattern, {"/"}, true)
local hiddens = tx.foreach(segments,function(e)return e:match("^%%%.")==nil end)
local function is_visible(s,i)
return not hiddens[i] or s:match("^%.") == nil
local function is_visible(s,i)
return not hiddens[i] or s:match("^%.") == nil
end

local function magical(s)
Expand Down Expand Up @@ -184,7 +184,7 @@ function sh.internal.glob(eword)
relative_separator = "/"
end
return paths
end
end

function sh.getMatchingPrograms(baseName)
if not baseName or baseName == "" then return {} end
Expand All @@ -205,7 +205,7 @@ function sh.getMatchingPrograms(baseName)
end
end
return result
end
end

function sh.getMatchingFiles(partial_path)
-- name: text of the partial file name being expanded
Expand Down Expand Up @@ -239,7 +239,7 @@ function sh.getMatchingFiles(partial_path)
result[1] = result[1] .. "/"
end
return result
end
end

function sh.internal.hintHandlerSplit(line)
-- I do not plan on having text tokenizer parse error on
Expand Down Expand Up @@ -293,7 +293,7 @@ function sh.internal.hintHandlerSplit(line)
else
return prefix, nil, normal
end
end
end

function sh.internal.hintHandlerImpl(full_line, cursor)
-- line: text preceding the cursor: we want to hint this part (expand it)
Expand Down Expand Up @@ -333,8 +333,8 @@ function sh.internal.hintHandlerImpl(full_line, cursor)
local resultSuffix = suffix
if #result > 0 and unicode.sub(result[1], -1) ~= "/" and
not suffix:sub(1,1):find('%s') and
#result == 1 or searchInPath then
resultSuffix = " " .. resultSuffix
#result == 1 or searchInPath then
resultSuffix = " " .. resultSuffix
end

table.sort(result)
Expand All @@ -343,7 +343,7 @@ function sh.internal.hintHandlerImpl(full_line, cursor)
result[i] = prev .. result[i] .. resultSuffix
end
return result
end
end

-- verifies that no pipes are doubled up nor at the start nor end of words
function sh.internal.hasValidPiping(words, pipes)
Expand All @@ -358,7 +358,7 @@ function sh.internal.hasValidPiping(words, pipes)
pipes = pipes or tx.sub(text.syntax, semi_split + 1)

local state = "" -- cannot start on a pipe

for w=1,#words do
local word = words[w]
for p=1,#word do
Expand Down Expand Up @@ -459,7 +459,7 @@ function sh.internal.splitStatements(words, semicolon)
checkArg(1, words, "table")
checkArg(2, semicolon, "string", "nil")
semicolon = semicolon or ";"

return tx.partition(words, function(g, i)
if isWordOf(g, {semicolon}) then
return i, i
Expand All @@ -482,7 +482,7 @@ end
function sh.internal.groupChains(s)
checkArg(1,s,"table")
return tx.partition(s,function(w)return isWordOf(w,{"&&","||"})end)
end
end

function sh.internal.remove_negation(chain)
if isWordOf(chain[1], {"!"}) then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function text.split(input, delimiters, dropDelims, di)
i=add(next, i, di+1, 1, #next)
end
end

return result
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function lib.sub(tbl,f,l)
r[#r+1]=tbl[i]
end
return r
end
end

-- Returns a list of subsets of tbl where partitioner acts as a delimiter.
function lib.partition(tbl,partitioner,dropEnds,f,l)
Expand Down Expand Up @@ -64,7 +64,7 @@ function lib.partition(tbl,partitioner,dropEnds,f,l)
end

return result
end
end

-- calls callback(e,i,tbl) for each ith element e in table tbl from first
function lib.foreach(tbl,c,f,l)
Expand Down Expand Up @@ -106,4 +106,4 @@ function lib.at(tbl, index)
current_index = current_index + 1
end
return nil, current_index - 1 -- went one too far
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ end
function filesystem.exists(path)
if not filesystem.realPath(filesystem.path(path)) then
return false
end
end
local node, rest, vnode, vrest = findNode(path)
if not vrest or vnode.links[vrest] then -- virtual directory or symbolic link
return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function pipe.createCoroutineStack(root, env, name)
return pco
end

local pipe_stream =
local pipe_stream =
{
continue = function(self, exit)
local result = table.pack(coroutine.resume(self.next))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ function sh.internal.executePipes(pipe_parts, eargs, env)
commands[#commands + 1] = table.pack(table.remove(args, 1), args, redirects)
end

local threads, reason = sh.internal.createThreads(commands, env, {[#commands]=eargs})
local threads, reason = sh.internal.createThreads(commands, env, {[#commands]=eargs})
if not threads then return false, reason end
return process.internal.continue(threads[1])
end
Expand Down
Loading

0 comments on commit 3831a86

Please sign in to comment.