summaryrefslogtreecommitdiffstats
path: root/nix-utils.sh
diff options
context:
space:
mode:
Diffstat (limited to 'nix-utils.sh')
-rw-r--r--nix-utils.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/nix-utils.sh b/nix-utils.sh
index 9e2fd3c..a34a2ee 100644
--- a/nix-utils.sh
+++ b/nix-utils.sh
@@ -6,6 +6,13 @@ Yellow='\e[0;33m'
Green='\e[0;32m'
#
+# Check whether a string (2nd arg) contains a substring (1st arg)
+#
+stringcontains() {
+ [ -z "${2##*$1*}" ]
+}
+
+#
# Print on stderr, in red
#
stderr() {
@@ -28,6 +35,25 @@ stdout() {
}
#
+# List all available commands as script path
+#
+all_commands() {
+ find $(dirname ${BASH_SOURCE[0]}) \
+ -type f \
+ -executable \
+ -name "nix-script-*.sh"
+}
+
+#
+# Get the name of the script file for the command passed as argument
+#
+# Does not check whether the file exists.
+#
+script_for() {
+ echo "$(dirname ${BASH_SOURCE[0]})/nix-script-${1}.sh"
+}
+
+#
# Get the command name from a script path
#
scriptname_to_command() {