shellopt

Command line argument parser in the form commonly used in ordinary shell.

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

Summary

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

Tags

Installation

nimble install shellopt
choosenim install shellopt
git clone https://github.com/uga-rosa/shellopt.nim

OS Compatibility

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

Source

Repository https://github.com/uga-rosa/shellopt.nim
Homepage https://github.com/uga-rosa/shellopt.nim
Registry Source nimble_official

README

shellopt.nim

Nim library for CLI tool, parsing command line arguments. Unlike the Nim default, it is adapted to the standard format of the shell.

Usage

# Install this library
nimble install shellopt

# Example source code
cat <<EOL > shellopt_test.nim
import shellopt, options

proc main() =
  let setArgSuccess = setArg(
    ArgOpt(
      long: "flag",
      short: "f",
      flag: true,
    ),
    ArgOpt(
      long: "value",
      short: "v",
    )
  )
  doAssert(setArgSuccess, "setArg() failed")

  echo getBool("flag").get
  echo getBool("f").get
  echo getString("value").get
  echo getString("v").get

when isMainModule:
  main()
EOL

# Run
nim c shellopt_test.nim
./shellopt_test --flag --value hoge