From f603dd5b4139cc1e7b2127eb1b9fcfe82d5176ba Mon Sep 17 00:00:00 2001 From: merakor Date: Wed, 24 Mar 2021 05:22:12 +0000 Subject: docs: update FossilOrigin-Name: 1830ef7f1ff3b725999ac81b9123fb7bf0c00ab3b6f82a0027bc24f87e04ba67 --- docs/cpt.org | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) (limited to 'docs/cpt.org') diff --git a/docs/cpt.org b/docs/cpt.org index 7f0982e..9ffa37a 100644 --- a/docs/cpt.org +++ b/docs/cpt.org @@ -910,22 +910,27 @@ This function was taken from [[https://github.com/ko1nksm/readlinkf][POSIX sh re symbolic links until it reaches the actual file. ** TODO System Functions -- [ ] Add description +:PROPERTIES: +:DESCRIPTION: Functions to manipulate your system +:END: *** =as_root()= :PROPERTIES: :DESCRIPTION: Run a command as the root user :END: -=as_root()= calls the rest of the arguments as a different user. Unless a =user= +=as_root()= calls the rest of the arguments as a different user. Unless a ~$user~ environment variable is set, it will call the following arguments as the root user. It supports the following programs for privilege escalation with the following order: -1. =sls= +1. =ssu= 2. =sudo= 3. =doas= 4. =su= +The program called for this operation can be overridden using the ~$CPT_SU~ +variable. + ** TODO Package Functions :PROPERTIES: :DESCRIPTION: Manipulate, or query anything related to packages @@ -973,23 +978,35 @@ This function checks whether a given package fits the proper package specification. This function *does not return with failure, it exits outright* if it fails. -*** TODO =pkg_find()= +*** =pkg_find()= :PROPERTIES: :DESCRIPTION: Query package locations :END: =pkg_find()= is the tool for searching packages. It accepts up to 3 arguments. -- $1: Query :: This is the only mandatory argument. It accepts globbing, meaning - that shell wildcards can be used in the query. -- $2: Match :: If this exists =pkg_find()= will print every single match found - in the search path. If it doesn't, =pkg_find()= will print the first match and - exit. -- $3: Type :: This is the argument to be passed to the =test= function. Unless - this argument is given, it defaults to =-d=, which tests for directories. +- $1: Query :: + This is the only mandatory argument. It accepts globbing, meaning that shell + wildcards can be used in the query. +- $2: Match :: + If this exists =pkg_find()= will print every single match found in the search + path. If it doesn't, =pkg_find()= will print the first match and exit. +- $3: Type :: + This is the argument to be passed to the =test= function. Unless this argument + is given, it defaults to =-d=, which tests for directories. #+begin_src sh +# Returns the first match of cpt pkg_find cpt + +# Returns all matches of cpt +pkg_find cpt all + +# Returns all globbed matches for cpt* (e.g. cpt and cpt-extra) +pkg_find 'cpt*' all + +# Returns all matching cpt-* executables on user's PATH +SEARCH_PATH=$PATH pkg_find 'cpt-*' all -x #+end_src *** TODO =pkg_get_base()= -- cgit v1.2.3