aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap.nu14
-rw-r--r--src/versions.nu25
2 files changed, 39 insertions, 0 deletions
diff --git a/src/bootstrap.nu b/src/bootstrap.nu
new file mode 100644
index 0000000..0137759
--- /dev/null
+++ b/src/bootstrap.nu
@@ -0,0 +1,14 @@
+#
+# ~~~ bootstraps nunvm
+#
+
+#
+# ~~~ main bootstrap function
+export def main []: nothing -> nothing {
+
+ # nunvm dir
+ let NUNVM_DIR = $"($env.HOME)/.nunvm" # todo: allow customising this
+
+ mkdir $NUNVM_DIR
+ mkdir $"($NUNVM_DIR)/versions"
+}
diff --git a/src/versions.nu b/src/versions.nu
new file mode 100644
index 0000000..f5b73b4
--- /dev/null
+++ b/src/versions.nu
@@ -0,0 +1,25 @@
+#
+# ~~~ nodejs version tools
+#
+
+#
+# ~~~ get list of versions
+export def "versions list" [
+ --local
+]: nothing -> list<string> {
+
+ mut versions = []
+
+ if ($local) {
+
+ let NUNVM_DIR = $"($env.HOME)/.nunvm/versions"
+ $versions = (ls -s $NUNVM_DIR | get name)
+
+ } else {
+
+ $versions = (http get https://api.github.com/repos/nodejs/node/releases | sort-by -r tag_name | get tag_name)
+
+ }
+
+ return $versions
+}