commit 0796a1f30128d6f8237868b00e02d238d1d855bf
parent e42193ae278d1999221de8f65dacd7644e8c2372
Author: finwo <finwo@pm.me>
Date: Tue, 17 Oct 2023 21:47:50 +0200
Fix bad inclusion in src/command/add/index.sh
Diffstat:
3 files changed, 77 insertions(+), 133 deletions(-)
diff --git a/README.md b/README.md
@@ -1,55 +0,0 @@
-dep
-======
-
-General purpose dependency manager, with a slight focus on static C libraries
-
-Usage
------
-
-```
-Usage: dep [global options] <command> [options] [-- ...args]
-
-Global options:
- n/a
-
-Commands:
- a(dd) Add a new dependency to the project
- i(nstall) Install all the project's dependencies
- h(elp) [topic] Show this help or the top-level info about a command
- r(epo(sitory)) Repository management
-
-Help topics:
- global This help text
- add More detailed explanation on the add command
- install More detailed explanation on the install command
- repository More detailed explanation on the repository command
-```
-
-Installation
-------------
-
-To install dep, simply download [dist/dep](dist/dep) and place it in your
-`/usr/local/bin` directory or anywhere else that's included in your `$PATH`.
-
-Building
---------
-
-Building this dependency manager requires
-[preprocess](https://pypi.org/project/preprocess/) which you can install by
-running `pip install preprocess`.
-
-After fetching the preprocess dependency, you can build & install dep by running
-the following commands:
-
-```sh
-make
-sudo make install
-```
-
-To install the binary in a location other than `/usr/local/bin`, pass the
-`DESTDIR` definition to the `make install` command (default: `/usr/local`).
-
-License
--------
-
-This project falls under the [MIT license](LICENSE)
diff --git a/dist/dep b/dist/dep
@@ -48,83 +48,6 @@ function cmd_help {
cmds[${#cmds[*]}]="h"
cmds[${#cmds[*]}]="help"
-#include "util/ini.sh"
-
-read -r -d '' help_topics[add] <<- EOF
-Usage: dep [global options] add <name> <url>
-
-Description:
-
- The add command will add a dependency to your package.ini and trigger the
- install command to do the actual install.
-
-Arguments:
-
- name The name of the dependency that will be installed. This will be used as
- the target directory within lib as well.
-
- url The url pointing to the package.ini that describes the dependency.
-EOF
-
-CMD_ADD_PKG=
-CMD_ADD_SRC=
-
-function arg_a {
- arg_add "$@"
- return $?
-}
-function arg_add {
-
- # Check if name exists in the repositories
- # Returns if found
- mkdir -p "${HOME}/.config/finwo/dep/repositories.d"
- while read repo; do
-
- # Trim whitespace
- repo=${repo##*( )}
- repo=${repo%%*( )}
-
- # Remove comments and empty lines
- if [[ "${repo:0:1}" == '#' ]] || [[ "${repo:0:1}" == ';' ]] || [[ "${#repo}" == 0 ]]; then
- continue
- fi
-
- while read line; do
- pkgname="${line%%=*}"
- pkgloc="${line##*=}"
- # If found, return it
- if [ "${pkgname}" == "$1" ]; then
- CMD_ADD_SRC="${pkgloc}"
- break 2
- fi
- done < <(curl --location --silent "${repo}")
- done < <(find "${HOME}/.config/finwo/dep/repositories.d" -type f -name '*.cnf' | xargs -n 1 -P 1 cat)
-
- # Need 2 arguments from here on out
- if [ -z "${CMD_ADD_SRC}" ] && [ $# != 2 ]; then
- echo "Add command requires 2 arguments" >&2
- exit 1
- fi
-
- CMD_ADD_PKG="$1"
- if [ -z "${CMD_ADD_SRC}" ]; then
- CMD_ADD_SRC="$2"
- fi
-
- return 0
-}
-
-function cmd_a {
- cmd_add "$@"
- return $?
-}
-function cmd_add {
- OLD_PKG=$(ini_foreach ini_output_full "package.ini")
- (echo "dependencies.${CMD_ADD_PKG}=${CMD_ADD_SRC}" ; echo -e "${OLD_PKG}") | ini_write "package.ini"
-}
-
-cmds[${#cmds[*]}]="a"
-cmds[${#cmds[*]}]="add"
# Required for the whitespace trimming
@@ -224,6 +147,82 @@ fi
# None
+read -r -d '' help_topics[add] <<- EOF
+Usage: dep [global options] add <name> <url>
+
+Description:
+
+ The add command will add a dependency to your package.ini and trigger the
+ install command to do the actual install.
+
+Arguments:
+
+ name The name of the dependency that will be installed. This will be used as
+ the target directory within lib as well.
+
+ url The url pointing to the package.ini that describes the dependency.
+EOF
+
+CMD_ADD_PKG=
+CMD_ADD_SRC=
+
+function arg_a {
+ arg_add "$@"
+ return $?
+}
+function arg_add {
+
+ # Check if name exists in the repositories
+ # Returns if found
+ mkdir -p "${HOME}/.config/finwo/dep/repositories.d"
+ while read repo; do
+
+ # Trim whitespace
+ repo=${repo##*( )}
+ repo=${repo%%*( )}
+
+ # Remove comments and empty lines
+ if [[ "${repo:0:1}" == '#' ]] || [[ "${repo:0:1}" == ';' ]] || [[ "${#repo}" == 0 ]]; then
+ continue
+ fi
+
+ while read line; do
+ pkgname="${line%%=*}"
+ pkgloc="${line##*=}"
+ # If found, return it
+ if [ "${pkgname}" == "$1" ]; then
+ CMD_ADD_SRC="${pkgloc}"
+ break 2
+ fi
+ done < <(curl --location --silent "${repo}")
+ done < <(find "${HOME}/.config/finwo/dep/repositories.d" -type f -name '*.cnf' | xargs -n 1 -P 1 cat)
+
+ # Need 2 arguments from here on out
+ if [ -z "${CMD_ADD_SRC}" ] && [ $# != 2 ]; then
+ echo "Add command requires 2 arguments" >&2
+ exit 1
+ fi
+
+ CMD_ADD_PKG="$1"
+ if [ -z "${CMD_ADD_SRC}" ]; then
+ CMD_ADD_SRC="$2"
+ fi
+
+ return 0
+}
+
+function cmd_a {
+ cmd_add "$@"
+ return $?
+}
+function cmd_add {
+ OLD_PKG=$(ini_foreach ini_output_full "package.ini")
+ (echo "dependencies.${CMD_ADD_PKG}=${CMD_ADD_SRC}" ; echo -e "${OLD_PKG}") | ini_write "package.ini"
+}
+
+cmds[${#cmds[*]}]="a"
+cmds[${#cmds[*]}]="add"
+
read -r -d '' help_topics[install] <<- EOF
Usage: dep [global options] install
diff --git a/src/command/add/index.sh b/src/command/add/index.sh
@@ -1,4 +1,4 @@
-#include "util/ini.sh"
+# #include "util/ini.sh"
read -r -d '' help_topics[add] <<- EOF
# #include "help.txt"