]> Dogcows Code - chaz/yoink/blobdiff - build/config.lua
remove some unused stlplus modules
[chaz/yoink] / build / config.lua
index fa522cf9247a31b0b530e5923d78fe63737d178b..6a72455103bbc068824fb24ee5530e08365ef658 100644 (file)
@@ -71,8 +71,8 @@ end
 
 local arguments                = parseArguments(unpack(arg))
 local interactive      = arguments["--interactive"]
-local rules                    = arguments["--rules"]      or "options.lua"
-local configfile       = arguments["--configfile"] or "config.mk"
+local rules            = arguments["--rules"]          or "options.lua"
+local configfile       = arguments["--configfile"]     or "config.mk"
 local printendmsg      = arguments["--print-instructions"]
 local exportHeader     = arguments["--export-header"]
 local exportTerms      = arguments["--export-terms"]
@@ -92,7 +92,9 @@ local function beginProcess(title, caption)
        return function(progress, caption)
                if progress ~= nil
                then
-                       if 0.0 <= progress and progress <= 1.0 then progress = progress * 100 end
+                       if 0.0 <= progress and progress <= 1.0 then
+                               progress = progress * 100
+                       end
                        return updater(progress, caption)
                end
                print()
@@ -103,16 +105,12 @@ end
 local function loadDialog(name, configfile)
        local dialog
        local result, err = pcall(function() dialog = require "dialog" end)
-       if not result
-       then
-               printWarning(err)
-               return nil
-       end
+       if not result then printWarning(err) return nil end
        dialog.title = string.format("%s - %s Configuration", configfile, name)
-       printInfo = dialog.msgbox
-       printWarning = dialog.msgbox
-       printError = dialog.msgbox
-       beginProcess = dialog.gauge
+       printInfo       = dialog.msgbox
+       printWarning    = dialog.msgbox
+       printError      = dialog.msgbox
+       beginProcess    = dialog.gauge
        return dialog
 end
 
@@ -185,20 +183,20 @@ local Option = util.class()
 ---------------------------------------------------------------------------
 
 function Option:__init(rule, lookup, objects)
-       self.name               = rule.name
+       self.name       = rule.name
        self.caption    = rule.caption
-       self.help               = rule.help
-       self.value              = rule.value
-       self.symbol             = rule.symbol
+       self.help       = rule.help
+       self.value      = rule.value
+       self.symbol     = rule.symbol
        self.cmdline    = rule.cmdline
-       self.config             = rule.config
-       self.export             = rule.export
+       self.config     = rule.config
+       self.export     = rule.export
        self.visible    = rule.visible
-       self.check              = rule.check
-       self.temp               = rule.temp
-       self.before             = rule.before   
-       self.after              = rule.after    
-       self.lookup             = lookup or {}
+       self.check      = rule.check
+       self.temp       = rule.temp
+       self.before     = rule.before   
+       self.after      = rule.after    
+       self.lookup     = lookup or {}
        self.objects    = objects or {}
 
        if type(self.check) == "function"   then setfenv(self.check, self.lookup) end
@@ -327,7 +325,6 @@ function Option:writeSymbol(fd)
        if self.symbol ~= nil and not self.temp
        then
                fd:write(util.align(self.symbol, "= " .. tostring(self.lookup[self.symbol]), 16) .. "\n")
-               --fd:write(string.format("%s\t= %s\n", self.symbol, tostring(self.lookup[self.symbol])))
        end
 end
 
@@ -339,7 +336,7 @@ end
 function Option:writeSedLine(fd)
        if self.export
        then
-               local value     = self:toExpandedString():gsub("/", "\\/")
+               local value = self:toExpandedString():gsub("/", "\\/")
                local function writeLine(key)
                        key = tostring(key):gsub("/", "\\/")
                        fd:write(string.format("s/@%s@/%s/g\n", key, value))
@@ -398,11 +395,11 @@ function Option:printHelpLine()
 end
 
 function Option:getHelpText()
-       local value             = self:toString()
-       local help              = self.help or "No help available.\n"
-       local name              = self.name or "Unnamed"
+       local value     = self:toString()
+       local help      = self.help or "No help available.\n"
+       local name      = self.name or "Unnamed"
        local symbol    = self:getSymbol() or "None"
-       local arg               = self:getArg() or "None"
+       local arg       = self:getArg() or "None"
 
        local problem   = self:getProblem()
        if problem then problem = "\nProblem(s):\n" .. problem
@@ -591,7 +588,7 @@ end
 function BooleanOption:writeCppLine(fd)
        if self.config
        then
-               local value     = self.lookup[self.symbol]
+               local value = self.lookup[self.symbol]
                local function writeLine(key)
                        -- Reverse the value if key starts with a bang.
                        local value = value
@@ -813,8 +810,7 @@ function GroupOption:showMenu(dialog)
                                dialog.msgbox(value.name, value:getHelpText(), {["--no-collapse"] = true})
                                selected = value:getMenuItem()
                        else
-                               dialog.msgbox("No Help",
-                                                         "Sorry, no help is available for this option.")
+                               dialog.msgbox("No Help", "Sorry, no help is available for this option.")
                        end
                else
                        running = false
@@ -964,8 +960,7 @@ if interactive then loadDialog(name, configfile) end
 options:convertDependenciesToDependants()
 checkSymbols(options:getObjects())
 
-if dialog
-then
+if dialog then
        local action = options:runMenu()
        if action == "exit" or action == "error"
        then
@@ -975,8 +970,7 @@ then
                options:saveToFile(configfile)
                print("configuration saved to " .. configfile)
        end
-elseif options:isValid()
-then
+elseif options:isValid() then
        options:saveToFile(configfile)
 else
        printError("Uh oh!", [[
This page took 0.020799 seconds and 4 git commands to generate.