WIP package manager written in POSIX shell inspired by VOID's xbps-src bash script (by kamber-linux)


Basic neko repo stats
4 days ago


Posts where neko has been mentioned. We have used some of these posts to build our list of alternatives and similar projects.
  • Aligning result of find in POSIX shell
    Hi! I'm working on a POSIX shell script package manager (you can here it here). Within the script, there is a function neko find. It works somewhat okay, and here is how it's defined: shift 1 case "[email protected]" in "--help" | "-h") help find ;; esac [ -z "${1}" ] && usage find [ ! -d "${pkgs_dir}" ] && { neko_msg error "No srcpkgs directory found" neko_msg normal "Run ${0} init" exit } for arg do neko_msg normal "$(find "${pkgs_dir}" ! -name srcpkgs -prune -name "*${arg}*" | wc -l) result(s) found for ${arg}" find "${pkgs_dir}" ! -name srcpkgs -prune -name "*${arg}*" | while read -r line do . "${line}"/template 2>/dev/null # TODO # Find better way to find sub pkgs such as -devel # At the moment, one must type the exact name # e.g. neko find musl-devel if [ -n "$(command -v "$(echo "${arg}" | sed 's/\-/_/g')"_pkg)" ] then "$(echo "${arg}" | sed 's/\-/_/g')"_pkg fi # otherwise -git-_1 can occur if [ -n "${distfiles}" ] then printf "^[[1m%s^[[0m\t%s\n" "${pkgname}-${version}_${revision}" "${short_desc}" else printf "^[[1m%s^[[0m\t%s\n" "${pkgname}_${revision}" "${short_desc}" fi unset distfiles unset pkgname unset version unset revision unset short_desc done done The problem is the alignmnet. I could set something like printf "%30s\n" to force it to be 30 characters out. but this looks messy. I know this will involve a while loop keeping track of the length of the longest name. I know that the length of a var can be evaluated via ${#VARIABLE}. The goal is to have it dynamically aligned / spaced based off of the output. I would like a POSIX solution as the system I'm making this for won't have things like GNU Coreutils - it will have a suckless userspace and won't use bash but dash.