aboutsummaryrefslogtreecommitdiff
path: root/examples/tomo-install
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-17 19:29:28 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-03-17 19:29:28 -0400
commit0bba31912665a82f848642e6b4247071a3ee177a (patch)
treeae5c3ac7501a0841c9a858d6559a0dfb7db69035 /examples/tomo-install
parent94993c5f113b27083e586c7620eb896fe750c6d1 (diff)
Big overhaul:
- Clean up environment code using type strings instead of manually defining types - Add Commands module - Move Shell lang into an example module that uses Commands module - Fix some bugs with chained library dependencies
Diffstat (limited to 'examples/tomo-install')
-rw-r--r--examples/tomo-install/tomo-install.tm9
1 files changed, 5 insertions, 4 deletions
diff --git a/examples/tomo-install/tomo-install.tm b/examples/tomo-install/tomo-install.tm
index 43e23028..0205c380 100644
--- a/examples/tomo-install/tomo-install.tm
+++ b/examples/tomo-install/tomo-install.tm
@@ -1,3 +1,4 @@
+use shell
_USAGE := "
tomo-install file.tm...
@@ -33,7 +34,7 @@ func main(paths:[Path]):
for url in urls:
original_url := url
url_without_protocol := url:trim($|http{0-1 s}://|, trim_right=no)
- hash := $(echo -n @url_without_protocol | sha256sum):run()!:slice(to=32)
+ hash := $Shell@(echo -n @url_without_protocol | sha256sum):get_output()!:slice(to=32)
if (~/.local/share/tomo/installed/$hash):is_directory():
say("Already installed: $url")
skip
@@ -61,14 +62,14 @@ func main(paths:[Path]):
echo @original_url > ~/.local/share/tomo/installed/@hash/source.url
tomo -L ~/.local/share/tomo/installed/@hash
ln -f -s ../installed/@hash/lib@hash.so ~/.local/share/tomo/lib/lib@hash.so
- `:run()!)
+ `:get_output()!)
if alias:
- say($(
+ say($Shell(
set -exuo pipefail
ln -f -s @hash ~/.local/share/tomo/installed/@alias
ln -f -s lib@hash.so ~/.local/share/tomo/lib/lib@alias.so
- ):run()!)
+ ):get_output()!)
say("$\[1]Installed $url!$\[]")