From b21295f9fbb793c60c74a1b95234f595a77eec0a Mon Sep 17 00:00:00 2001 From: Izaya Date: Fri, 27 Jul 2018 03:38:45 +1000 Subject: [PATCH] added the -s flag to fget for getting file sizes --- FRequest/OpenOS/usr/bin/fget.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/FRequest/OpenOS/usr/bin/fget.lua b/FRequest/OpenOS/usr/bin/fget.lua index 928c2e2..904e6c9 100644 --- a/FRequest/OpenOS/usr/bin/fget.lua +++ b/FRequest/OpenOS/usr/bin/fget.lua @@ -1,5 +1,6 @@ local net = require "net" local event = require "event" +local shell = require "shell" local function parseURL(url) local proto,addr = url:match("(.-)://(.+)") @@ -11,12 +12,16 @@ local function parseURL(url) return proto, host, port, path end -local tArgs = {...} +local tArgs, tFlags = shell.parse(...) local proto, host, port, path = parseURL(tArgs[1]) port = tonumber(port) or 70 local socket = net.open(host,port) -socket:write("t"..path.."\n") +if tFlags.s then + socket:write("s"..path.."\n") +else + socket:write("t"..path.."\n") +end local c = socket:read(1) repeat c = socket:read(1)