diff options
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/plugins.org | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/doc/plugins.org b/doc/plugins.org index 442af34..4d14771 100644 --- a/doc/plugins.org +++ b/doc/plugins.org @@ -1367,7 +1367,7 @@ *** =PacmanUpdates (Zero, One, Many, Error) Rate= - - *This constructor is deprecated. Use =PacmanUpdatesK= or =PacmanUpdatesNoK= instead.* + - *This constructor is deprecated. Use =PacmanUpdatesK=, =PacmanUpdatesPredicateK=, or =PacmanUpdatesNoK= instead.* - Aliases to =pacman= - =Zero=: a =String= to use when the system is up to date. - =One=: a =String= to use when only one update is available. @@ -1407,6 +1407,38 @@ _ -> error "This is impossible" #+end_src +*** =PacmanUpdatesPredicateK Rate IsKernelUpdate (Bool -> Either String (Int, Bool) -> String)= + + - Aliases to =pacman= + - =IsKernelUpdate=: a =String -> Bool= predicate that receives each available + package name and returns =True= for kernel packages. This is useful for + distributions with versioned kernel package names, such as Manjaro's + =linux618= or =linux70= packages. + - =(Bool -> Either String (Int, Bool) -> String)=: a function producing the + string to be shown by the plugin; it is fed with a =Bool= telling whether + the running kernel is older than the installed kernel, and an =Int= and + =Bool= telling the number of available updates and whether one of them + matches the kernel predicate (or an error message if =checkupdates= fails). + - Example: + This example requires =import Data.Char (isDigit)= and + =import Data.List (stripPrefix)= in your configuration. + #+begin_src haskell + PacmanUpdatesPredicateK + 600 + ( \packageName -> + case stripPrefix "linux" packageName of + Just n -> not (null n) && all isDigit n + Nothing -> False + ) + $ \oldKern mayb -> (if oldKern then "Running old kernel!" else "") ++ + case mayb of + Left _ -> "Some error occurred!" + Right (0, False) -> "Up to date" + Right (n, pendingK) | n >= 1 -> show n ++ " updates available" + ++ if pendingK then " including a kernel update" else "" + _ -> error "This is impossible" + #+end_src + *** =PacmanUpdatesNoK Rate (Bool -> Either String Int -> String)= - Aliases to =pacman= |
