From 91925e601d9809bf17e6a79cfa4cfad9937ed29a Mon Sep 17 00:00:00 2001 From: "Adrian C. (anrxc)" Date: Thu, 4 Feb 2010 18:36:27 +0100 Subject: pkg: pacman moved to generic packages module --- init.lua | 2 +- pacman.lua | 37 ------------------------------------- pkg.lua | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 38 deletions(-) delete mode 100644 pacman.lua create mode 100644 pkg.lua diff --git a/init.lua b/init.lua index 34cf10c..0f41ef3 100644 --- a/init.lua +++ b/init.lua @@ -39,7 +39,7 @@ require("vicious.mdir") require("vicious.gmail") require("vicious.entropy") require("vicious.org") -require("vicious.pacman") +require("vicious.pkg") require("vicious.mpd") require("vicious.volume") require("vicious.weather") diff --git a/pacman.lua b/pacman.lua deleted file mode 100644 index 8734c2c..0000000 --- a/pacman.lua +++ /dev/null @@ -1,37 +0,0 @@ ---------------------------------------------------- --- Licensed under the GNU General Public License v2 --- * (c) 2010, Adrian C. ---------------------------------------------------- - --- {{{ Grab environment -local tonumber = tonumber -local io = { popen = io.popen } -local setmetatable = setmetatable ---local string = { match = string.match } --- }}} - - --- Pacman: provides number of pending updates on Arch Linux -module("vicious.pacman") - - --- {{{ Pacman widget type -local function worker(format) - -- Initialise counters - local updates = 0 - - -- Check if updates are available - local f = io.popen("pacman -Qu") - -- Exclude IgnorePkg and count deps - --local f = io.popen("pacman -Sup") - - for line in f:lines() do - updates = updates + 1 - end - f:close() - - return {updates} -end --- }}} - -setmetatable(_M, { __call = function(_, ...) return worker(...) end }) diff --git a/pkg.lua b/pkg.lua new file mode 100644 index 0000000..917b893 --- /dev/null +++ b/pkg.lua @@ -0,0 +1,36 @@ +--------------------------------------------------- +-- Licensed under the GNU General Public License v2 +-- * (c) 2010, Adrian C. +--------------------------------------------------- + +-- {{{ Grab environment +local tonumber = tonumber +local io = { popen = io.popen } +local setmetatable = setmetatable +-- }}} + + +-- Pkg: provides number of pending updates on GNU/Linux +module("vicious.pkg") + + +-- {{{ Packages widget type +local function worker(format) + -- Initialise counters + local updates = 0 + + -- Check if updates are available on Arch + local f = io.popen("pacman -Qu") + --- Exclude IgnorePkg and count deps + ---local f = io.popen("pacman -Sup") + + for line in f:lines() do + updates = updates + 1 + end + f:close() + + return {updates} +end +-- }}} + +setmetatable(_M, { __call = function(_, ...) return worker(...) end }) -- cgit v1.2.3