Grab
grab statement for importing packages in Nim, similar to Groovy's Grape
Install / Use
/learn @metagn/GrabREADME
grab
Adds a grab statement for installing and importing Nimble packages
directly through Nim code, similar to Groovy's Grape and @Grab. Works
with NimScript, as all the computation is done at compile time.
This installs the package globally, and can affect compilation time. For this reason it should generally only be used for scripts, tests, snippets and the like.
import grab
# install the package `regex` if not installed already, and import it
grab "regex"
assert "abc.123".match(re"\w+\.\d+")
# run install command with the given arguments
grab package("-y https://github.com/arnetheduck/nim-result@#HEAD",
name = "result", forceInstall = true): # clarify package name to correctly query path
# imports from the package directory
import results
func works(): Result[int, string] =
result.ok(123)
func fails(): Result[int, string] =
result.err("abc")
assert works().isOk
assert fails().error == "abc"
Install with:
nimble install grab
Related Skills
node-connect
342.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
85.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
342.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
342.5kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
