nimsutils

Common utils for Nimscript

Pure Nim score 15/100 · tests present · no docs generated

Summary

Latest Version 0.1.0
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:26

Authors

  • madonuko

Installation

nimble install nimsutils
choosenim install nimsutils
git clone https://github.com/FyraLabs/nimsutils

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
nimsutils - - - - - - -

Dependencies

Package Version Optional
nim >= 2.0.2 No

Source

Repository https://github.com/FyraLabs/nimsutils
Homepage https://github.com/FyraLabs/nimsutils
Registry Source nimble_official

README

nimsutils

A bunch of utility functions for NimScript.

Why

Feel like NimScript is so cool but lacking a lot of stuff and breaks too easily? This is pretty much what you want. nimsutils include support for:

  • pretty logging
  • Last time I searched (2024-05-13) there are quite literally no good nimble packages for even nim itself. No good pretty loggers in even Nim! Ridiculous!
  • Logit exists but it's hard to customize, it's probably the closest thing.
  • running shell commands (run())
  • setting up tasks in nimble (xtask)
  • time support
  • yes you actually can't import std/[times, monotimes] in NimScript
  • you can do stuff like benchmarking with time "Benchmark name":
  • makefile-ish syntax supported using the @= operator

Example

There's literally an example in the nimsutils.nimble file:

xtask mytask, "description of mytask":
  hint "hi"
  trace "https://youtu.be/Tl62BvTYUVA"
  debug "huh?"
  note "My Notice"
  warn "My Warning"
  error "My Error"
  fatal "NYAAAAAA"
  run "echo 'Hello World'"
  run "!@#$%^ouch bad command"

nimble-mytask.png\ (Note: sh outputted Japanese due to my locale settings.)

There are more examples in test.nims.

Getting Started

Yes, you heard me: start using nimsutils by just:

  1. cloning this repository:
git clone https://github.com/FyraLabs/nimsutils --depth 1
# or
git submodule add https://github.com/FyraLabs/nimsutils vendor/nimsutils
  1. nim import nimsutils/src/nimsutils
  2. (optional) Replace task with xtask

[!WARNING] There is a bug where nimble install cannot install this package correctly.

As a workaround, you should clone this repository as a submodule instead.

Use Cases

  • https://github.com/madonuko/remap/blob/master/build.nims

PR welcomed for adding your project here! :3

Documentations

Index at https://fyralabs.github.io/nimsutils/.

[!NOTE] If you are encountering Error: VM problem: dest register is set, wrap the problematic code (most likely run()) inside a block: or a function. As to why this happens… Mystery.