commit c80de22314e48e35f2a681be9da6eef42c205244 Author: Maxwell Jeffress Date: Wed Jan 28 19:04:16 2026 +1100 Initial commit diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f55687c --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +SRCS = src/main.sols +TARGET = solspkg + +${TARGET}: ${SRCS} + solstice ${SRCS} -o ${TARGET} + +clean: + rm ${TARGET} diff --git a/solspkg b/solspkg new file mode 100755 index 0000000..8675e94 --- /dev/null +++ b/solspkg @@ -0,0 +1,97 @@ +#!/usr/bin/env ground +fun !input -string -string &msg +set &tmp_0 "" +set &retval $tmp_0 +drop &tmp_0 +print $msg +input &retval +return $retval +endfun +fun !print -string -string &msg +print $msg +return $msg +endfun +fun !println -string -string &msg +println $msg +return $msg +endfun +fun !request_Get -string -string &url +endfun +fun !request_Post -string -string &url -string &data +endfun +extern "request" +fun !file_Read -string -string &file +endfun +fun !file_Write -void -string &file -string &content +endfun +extern "fileio" +set &tmp_1 "package to install: " +call !input $tmp_1 &tmp_2 +set &thing $tmp_2 +drop &tmp_2 +set &tmp_3 "version number (default is latest): " +call !input $tmp_3 &tmp_4 +set &version $tmp_4 +drop &tmp_4 +set &tmp_5 "" +equal $version $tmp_5 &tmp_6 +drop &tmp_5 +not $tmp_6 &tmp_7 +if $tmp_7 %if_0 +drop &tmp_7 +drop &tmp_6 +set &tmp_8 "https://sols.dev/pkgs/" +add $tmp_8 $thing &tmp_9 +drop &tmp_8 +set &tmp_10 "/latest" +add $tmp_9 $tmp_10 &tmp_11 +drop &tmp_9 +drop &tmp_10 +call !request_Get $tmp_11 &tmp_12 +set &version $tmp_12 +drop &tmp_12 +@if_0 +set &tmp_13 "latest" +equal $version $tmp_13 &tmp_14 +drop &tmp_13 +not $tmp_14 &tmp_15 +if $tmp_15 %if_1 +drop &tmp_15 +drop &tmp_14 +set &tmp_16 "https://sols.dev/pkgs/" +add $tmp_16 $thing &tmp_17 +drop &tmp_16 +set &tmp_18 "/latest" +add $tmp_17 $tmp_18 &tmp_19 +drop &tmp_17 +drop &tmp_18 +call !request_Get $tmp_19 &tmp_20 +set &version $tmp_20 +drop &tmp_20 +@if_1 +set &tmp_21 "https://sols.dev/pkgs/" +add $tmp_21 $thing &tmp_22 +drop &tmp_21 +set &tmp_23 "/" +add $tmp_22 $tmp_23 &tmp_24 +drop &tmp_22 +drop &tmp_23 +add $tmp_24 $version &tmp_25 +drop &tmp_24 +set &tmp_26 ".sols" +add $tmp_25 $tmp_26 &tmp_27 +drop &tmp_25 +drop &tmp_26 +call !request_Get $tmp_27 &tmp_28 +set &file $tmp_28 +drop &tmp_28 +set &tmp_29 "/usr/lib/solstice/" +add $tmp_29 $thing &tmp_30 +drop &tmp_29 +set &tmp_31 ".sols" +add $tmp_30 $tmp_31 &tmp_32 +drop &tmp_30 +drop &tmp_31 +call !file_Write $tmp_32 $file &tmp_33 +set &tmp_34 "installed" +call !println $tmp_34 &tmp_35 diff --git a/src/main.sols b/src/main.sols new file mode 100644 index 0000000..07a4877 --- /dev/null +++ b/src/main.sols @@ -0,0 +1,26 @@ +use io +use request +use file + +// get package details +thing = input("package to install: ") +version = input("version number (default is latest): ") + +// if using default, get the latest version number +if version == "" { + version = request_Get("https://sols.dev/pkgs/" + thing + "/latest") +} + +if version == "latest" { + version = request_Get("https://sols.dev/pkgs/" + thing + "/latest") +} + +// get the file +file = request_Get("https://sols.dev/pkgs/" + thing + "/" + version + ".sols") + +// write the file +file_Write("/usr/lib/solstice/" + thing + ".sols", file) + +// tell the user +println("installed") +