From f1dd7fbd5491628d3455568607f4d411fc03c5a4 Mon Sep 17 00:00:00 2001 From: onefang Date: Thu, 6 Feb 2020 19:08:10 +1000 Subject: Print the help texts, and exit from the help and version command line options. --- apt-panopticommon.lua | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/apt-panopticommon.lua b/apt-panopticommon.lua index a8de87d..2bb5a16 100644 --- a/apt-panopticommon.lua +++ b/apt-panopticommon.lua @@ -30,20 +30,20 @@ APT.options = bandwidth = { typ = "number", - help = ' 0 = low - HTTP tests for all IPs of all mirrors (HEAD tests), but not URL sanity tests.\n' .. - ' 1 = medium - Also HTTP(S) redirect tests, other protocols, download Release files over HTTP, and check them.\n' .. - ' 2 = high - Also download Packages.xz files that changed, unpack and check them.\n' .. - ' Also download and check InRelease files\n.' .. - ' Pick a few small packages, download them, check their SHA512.\n' .. - ' 3 = more - Also pick more files and packages, some for each reelase / arch.\n' .. - ' 4 = all - Do absolutely everything.\n' .. - ' Actually download some Contents files, and some more Packages.xz, and package files.', + help = '\n 0 = low - HTTP tests for all IPs of all mirrors (HEAD tests), but not URL sanity tests.\n' .. + ' 1 = medium - Also HTTP(S) redirect tests, other protocols, download Release files over HTTP, and check them.\n' .. + ' 2 = high - Also download Packages.xz files that changed, unpack and check them.\n' .. + ' Also download and check InRelease files.\n' .. + ' Pick a few small packages, download them, check their SHA512.\n' .. + ' 3 = more - Also pick more files and packages, some for each release / arch.\n' .. + ' 4 = all - Do absolutely everything.\n' .. + ' Actually download some Contents files, and some more Packages.xz, and package files.', value = 2, }, referenceSite = { typ = "string", - help = "The mirror that is used as a reference, coz the oters sync to it.", + help = "The mirror that is used as a reference, coz the others sync to it.", value = "pkgmaster.devuan.org", }, roundRobin = @@ -134,9 +134,15 @@ APT.parseArgs = function(args) local option = "" for i, a in pairs(args) do if ("--help" == a) or ("-h" == a) then - print("I should write some docs, huh? Read README.md for instructions.") + print("Check the health of Devuan Linux package mirrors.") + for k, v in pairs(APT.options) do + print("") + print('--' .. k .. ' ' .. v.help) + end + os.exit() elseif "--version" == a then print("apt-panopticon version 0.2") + os.exit() elseif "-v" == a then APT.verbosity = APT.verbosity + 1 sendArgs = sendArgs .. a .. " " -- cgit v1.1