remove file-scoped parameters var

This commit is contained in:
Daniel Barlow 2024-03-04 23:11:04 +00:00
parent cbd3dfefc5
commit ffe9603c39

View file

@ -14,33 +14,32 @@
[linkname nil] {:link linkname :expecting "present"}
_ nil))
(local parameters
(or
(parse-args arg)
(assert false (.. "Usage: " (. arg 0) " [-v] ifname [present|up|running]"))))
(fn run-event [v]
(fn run-event [params v]
(let [got
(match v
;; - up: Reflects the administrative state of the interface (IFF_UP)
;; - running: Reflects the operational state (IFF_RUNNING).
{:event "newlink" :name parameters.link :up :yes :running :yes}
{:event "newlink" :name params.link :up :yes :running :yes}
{:present true :up true :running true}
{:event "newlink" :name parameters.link :up :yes}
{:event "newlink" :name params.link :up :yes}
{:present :true :up true}
{:event "newlink" :name parameters.link}
{:event "newlink" :name params.link}
{:present true }
_
{})]
(when (. got parameters.expecting)
(when (. got params.expecting)
(os.exit 0))))
(when parameters.verbose
(print (.. (. arg 0) ": waiting for "
parameters.link " to be " parameters.expecting)))
(let [parameters
(or
(parse-args arg)
(assert false (.. "Usage: " (. arg 0) " [-v] ifname [present|up|running]")))]
(when parameters.verbose
(print (.. (. arg 0) ": waiting for "
parameters.link " to be " parameters.expecting)))
(each [event (nl.events {:link true})]
(run-event event))
(each [event (nl.events {:link true})]
(run-event parameters event)))