diff options
author | merakor <cem@ckyln.com> | 2020-12-21 11:13:51 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2020-12-21 11:13:51 +0000 |
commit | 440af4f3ebfecd68dabf8ce5524fd3f953e81c71 (patch) | |
tree | d7ceaf1d040bad60822c87ad78ca30de76df1342 /src/cpt-list | |
parent | 36308f68ddd95984c1909c5ca00a6ab70544d15b (diff) | |
download | cpt-440af4f3ebfecd68dabf8ce5524fd3f953e81c71.tar.gz |
cpt: remove cpt-stat and cpt-readlink, add _stat() and _readlinkf
cpt-readlink and cpt-stat were unnecessary additions for mundane tasks. Since
they were binaries instead of scripts, they added an extra layer of complexity
to the library.
These functions are now included inside the package manager library with the names
_readlinkf() and _stat().
FossilOrigin-Name: 7e15e2b57ddcb834c4286c8d1ac0a28031ae4f5d39f3c6a99f5b3aa0e9a83d43
Diffstat (limited to 'src/cpt-list')
-rwxr-xr-x | src/cpt-list | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/cpt-list b/src/cpt-list index a161abf..363e22f 100755 --- a/src/cpt-list +++ b/src/cpt-list @@ -5,11 +5,23 @@ parser_definition() { setup REST help:usage -- "usage: ${0##*/} [-c] [pkg...]" msg -- '' 'Options:' flag CURRENT -c --current -- "Use the current directory as a package" + param PKG --check label:" --check PKG TRUE FALSE" -- \ + "Check if PKG exists and return the string of TRUE if"\ + "it exists, and the string of FALSE if it doesn't." \ + "Useful for optional packaging." global_options } if [ -f ./cpt-lib ]; then . ./cpt-lib; else . cpt-lib; fi +if [ "$PKG" ]; then + if pkg_list "$PKG" >/dev/null 2>&1; then + printf %s "$1" + else + printf %s "$2" + fi +else [ "$CURRENT" ] && set -- "${PWD##*/}" pkg_list "$@" +fi |