summaryrefslogtreecommitdiff
path: root/.config/nushell/remarkable.nu
diff options
context:
space:
mode:
authorWriterV2 <primary-v2@protonmail.com>2026-04-03 22:46:48 +0200
committerWriterV2 <primary-v2@protonmail.com>2026-04-03 22:46:48 +0200
commita1ec4771740d321df4480e8a7224fa10b59f0569 (patch)
tree5e97e8ced79b4fea057fab6e76f80849c053e401 /.config/nushell/remarkable.nu
Update repo with git init directly in home dir
Diffstat (limited to '.config/nushell/remarkable.nu')
-rw-r--r--.config/nushell/remarkable.nu18
1 files changed, 18 insertions, 0 deletions
diff --git a/.config/nushell/remarkable.nu b/.config/nushell/remarkable.nu
new file mode 100644
index 0000000..8a5522c
--- /dev/null
+++ b/.config/nushell/remarkable.nu
@@ -0,0 +1,18 @@
+export def upload [file: path] {
+ let filename = ($file | path parse | get stem)
+ let extension = ($file | path parse | get extension)
+ curl $"http://($env.REMARKABLE_IP)/upload" -H "Origin: http://192.168.178.24" -H "Referer: http://192.168.178.24" -H 'Connection: keep-alive' -F $"file=@($file);filename=($filename);type=application/($extension)"
+}
+
+export def download [collection_id?: string] {
+ curl $"http://($env.REMARKABLE_IP)/documents/($collection_id)"
+ | from json
+ | select VissibleName ID Type
+ | input list
+ | if $in.Type == 'DocumentType' {
+ let name = $in.VissibleName;
+ curl $"http://($env.REMARKABLE_IP)/download/($in.ID)/pdf" | save -f $"($name | str snake-case).pdf"
+ } else {
+ download $in.ID
+ }
+}