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