Include files
Package Manager Database
A incomplete list (to save typing) using a nested sequence format:
export sequence managers = { -- 1 -- 2 { "dnf", -- fedoraBased -- 3 {"dnf install", -- 4 "dnf reinstall", -- 5 "dnf search", -- 6 "dnf upgrade", -- 7 "dnf --refresh check-update", -- 8 "dnf --refresh upgrade", -- 9 "dnf --refresh check-update", -- 10 "dnf remove", -- 11 "dnf remove", -- 12 "dnf autoremove", -- 13 "dnf check-update" -- 14 } -- 15 }, -- 16 -- 17 -- add more as needed -- 18 -- 19 { "apt-get", -- 20 { "apt install", -- 21 "apt install --reinstall", -- 22 "apt search", -- 23 "apt upgrade", -- 24 "apt update", -- 25 "apt update; sudo apt upgrade", -- 26 "apt update", -- 27 "apt remove", -- 28 "apt remove --purge", -- 29 "apt autoremove" -- 30 } -- 31 }, -- 32 -- 33 { "equo", -- saybayon -- 34 { "equo i", -- 35 "equo i", -- 36 "equo s", -- 37 "equo u", -- 38 "equo up", -- 39 "equo up && sudo equo u", -- 40 "equo update --force", -- 41 "equo rm", -- 42 "equo rm --norecursive", -- 43 "equo cleanup" -- 44 } -- 45 }, -- all items followed by , if you use $ end marker -- 46 -- 47 $ } -- 48
Notes
- 1
- to make an identifier "visible" to an including program you must export it
global is used rarely and public is used to make a chain of includes
- 3
- there are no rules for using sequences, arrange data in any convient form
comments using -- can be added anywhere in source-code
- 48
- the $ marker is optional, but make it easy to add items to a sequence list
Which Manager is Installed?
This code is copied from the "New and having problems" thread. Thanks to mollusk and irv.
-- which.e -- 1 -- 2 include std/filesys.e -- 3 include std/io.e -- 4 -- 5 include PkgMgrs.e -- 6 -- 7 export function which() -- 8 -- 9 for i=1 to length( managers ) do -- 10 sequence pkmgr = locate_file( managers[i][1] ) -- 11 if file_type( pkmgr ) = 1 then -- 12 return i -- 13 end if -- 14 end for -- 15 -- 16 return 0 -- 17 end function -- 18 -- 19
- 6
- the database of package managers is imported to make the sequence managers visible
- 12
- a check to make sure that the identifier is a file and not a directory
Link to last page Tux utility
Not Categorized, Please Help
|