-
Notifications
You must be signed in to change notification settings - Fork 2
/
plum
executable file
·64 lines (58 loc) · 2.74 KB
/
plum
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/sh
if test "$1" = 'update'; then
echo "Pulling latest..."
cd ~/.plum/;
git pull;
# run command to update global deps.edn with latest :plum/* aliases
cd clj/ && clojure -m plum.update;
exit;
fi
if test "$1" = 'help'; then
echo "Usage: plum [command] [...args]";
echo "";
echo "plum is a helpful wrapper around the Clojure CLI tools and tools.deps for";
echo "running commands within a project."
echo ""
echo "If you're interested in learning more about how to use the Clojure CLI tools and"
echo "deps.edn directly, visit https://clojure.org/guides/deps_and_cli";
echo "";
echo "Available commands:";
echo " update: Updates plum commands to the latest version.";
echo " help: Shows this help message.";
echo " add [package] [version]: Adds the library package and version to local deps.edn";
echo " repl: Starts a REPL in the current project with advanced readline features.";
echo " See https://github.com/bhauman/rebel-readline";
echo " new [...args]: Creates a new Clojure(Script) project based on a template.";
echo " See https://github.com/seancorfield/clj-new";
echo " gen [...args]: Creates new file(s) based on a generator.";
echo " See https://github.com/seancorfield/clj-new#clj-generators";
echo " test [...args]: Executes tests within a project.";
echo " See https://github.com/cognitect-labs/test-runner";
echo " outdated [...args]: Reports out of date depencies and (optionally) upgrades them.";
echo " See https://github.com/Olical/depot";
echo " inject [command]: Inserts any of the above commands into your local deps.edn as an alias.";
echo "";
echo "For help with an individual command, see the linked repos in their description"
echo "for documentation and filing issues."
echo "";
echo "For any other help, see https://github.com/Lokeh/plum and #plum on clojurians.net Slack."
exit;
fi
version_split=`clojure -h | head -n1 | awk '{print $2}' | sed -e 's/\./ /g'`
v_major=`echo $version_split | awk '{print $1}'`
v_minor=`echo $version_split | awk '{print $2}'`
v_patch=`echo $version_split | awk '{print $3}'`
v_build=`echo $version_split | awk '{print $4}'`
if [[ v_major -gt 1 ]] || [[ v_minor -gt 10 ]] || [[ v_patch -gt 1 ]];
then
switch="M"
else
if [[ v_major -ge 1 ]] && [[ v_minor -ge 10 ]] && [[ v_patch -ge 1 ]] && [[ v_build -ge 697 ]] ;
then
switch="M"
else
switch="A"
fi
fi
echo "clojure -$switch:plum/$@"
clojure -$switch:plum/"$@"