commit eaa1ea5262b4ae3aed5d569906765aa886aa2993
parent 904b6b3e11f2a1af162a14e1e5c9967596040ee6
Author: aabacchus <ben@bvnf.space>
Date: Mon, 12 Jun 2023 23:45:46 +0100
rename to bliss
Diffstat:
8 files changed, 74 insertions(+), 61 deletions(-)
diff --git a/Makefile b/Makefile
@@ -0,0 +1,10 @@
+.POSIX:
+
+PREFIX = /usr
+LUA_LMOD = $$(pkgconf --variable=INSTALL_LMOD lua)
+
+install:
+ mkdir -p "$(DESTDIR)$(LUA_LMOD)/bliss"
+ cp bliss/*.lua "$(DESTDIR)$(LUA_LMOD)/bliss/"
+ mkdir -p "$(DESTDIR)$(PREFIX)/bin"
+ cp main.lua "$(DESTDIR)$(PREFIX)/bin/bliss"
diff --git a/README b/README
@@ -1,3 +1,6 @@
+BLISS
+=====
+
An implementation of the kiss package manager in Lua.
[ ] alternatives
diff --git a/libkiss/init.lua b/bliss/init.lua
diff --git a/libkiss/search.lua b/bliss/search.lua
diff --git a/libkiss/utils.lua b/bliss/utils.lua
diff --git a/kiss.lua b/kiss.lua
@@ -1,59 +0,0 @@
-#!/usr/bin/env lua
-local kiss = require 'libkiss'
-
-local function version()
- print("0.0.0")
-end
-
-local function usage()
- kiss.log(arg[0] .. " [a|b|c|d|i|l|r|s|u|U|v] [pkg]...")
- kiss.log("alternatives List and swap alternatives")
- kiss.log("build Build packages")
- kiss.log("checksum Generate checksums")
- kiss.log("download Download sources")
- kiss.log("install Install packages")
- kiss.log("list List installed packages")
- kiss.log("remove Remove packages")
- kiss.log("search Search for packages")
- kiss.log("update Update the repositories")
- kiss.log("upgrade Update the system")
- kiss.log("version Package manager version")
-
- os.exit(true)
-end
-
-local function args(arg)
- local args_map = {
- a = kiss.alternatives,
- b = kiss.build,
- c = kiss.checksum,
- d = kiss.download,
- H = kiss.help_ext,
- i = kiss.install,
- l = kiss.list,
- r = kiss.remove,
- s = kiss.search,
- u = kiss.update,
- U = kiss.upgrade,
- v = version,
- }
-
- if #arg < 1 then usage() end
-
- local char = string.sub(arg[1], 1, 1)
- if arg[1] == "upgrade" then char = 'U' end
-
- -- shift
- table.remove(arg, 1)
-
- local f = args_map[char]
- if f then
- f(env, arg)
- else
- -- TODO: ext
- usage()
- end
-end
-
-env = kiss.setup()
-args(arg)
diff --git a/main.lua b/main.lua
@@ -0,0 +1,59 @@
+#!/usr/bin/env lua
+local bliss = require 'bliss'
+
+local function version()
+ print("0.0.0")
+end
+
+local function usage()
+ bliss.log("bliss [a|b|c|d|i|l|r|s|u|U|v] [pkg]...")
+ bliss.log("alternatives List and swap alternatives")
+ bliss.log("build Build packages")
+ bliss.log("checksum Generate checksums")
+ bliss.log("download Download sources")
+ bliss.log("install Install packages")
+ bliss.log("list List installed packages")
+ bliss.log("remove Remove packages")
+ bliss.log("search Search for packages")
+ bliss.log("update Update the repositories")
+ bliss.log("upgrade Update the system")
+ bliss.log("version Package manager version")
+
+ os.exit(true)
+end
+
+local function args(arg)
+ local args_map = {
+ a = bliss.alternatives,
+ b = bliss.build,
+ c = bliss.checksum,
+ d = bliss.download,
+ H = bliss.help_ext,
+ i = bliss.install,
+ l = bliss.list,
+ r = bliss.remove,
+ s = bliss.search,
+ u = bliss.update,
+ U = bliss.upgrade,
+ v = version,
+ }
+
+ if #arg < 1 then usage() end
+
+ local char = string.sub(arg[1], 1, 1)
+ if arg[1] == "upgrade" then char = 'U' end
+
+ -- shift
+ table.remove(arg, 1)
+
+ local f = args_map[char]
+ if f then
+ f(env, arg)
+ else
+ -- TODO: ext
+ usage()
+ end
+end
+
+env = bliss.setup()
+args(arg)
diff --git a/test.lua b/test.lua
@@ -1,8 +1,8 @@
-kiss = require "libkiss"
+bliss = require "bliss"
function tts(t) local s = "{ " local sep = "" for k,v in pairs(t) do s = s..sep..k.."="..v sep = ', ' end return s .. ' }' end
-env = kiss.setup()
+env = bliss.setup()
for k,v in pairs(env) do
if "table" == type(v) then
print(k, tts(v))