lahl 0.0.3

lightweight argument handling library
Documentation
  • Coverage
  • 15.79%
    6 out of 38 items documented0 out of 9 items with examples
  • Size
  • Source code size: 38.18 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 6.15 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 19s Average build duration of successful builds.
  • all releases: 17s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • kaleidawave/experiments
    2 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • kaleidawave

lahl: lightweight-argument-handling-library

Provides

  • Defining the structure of a command-line program
  • Help / usage message generation
  • Non-macro based API

Features

  • endpoint grouping, e.g *program* experimental build *args* (two specifiers for name)
  • multiple for named and positional arguments

Key ideas

  • CLI defined by 'static slices
  • An endpoint is a section of a CLI. Specified by 1-2 initial arguments
  • An endpoint can have named and positional parameters
  • At runtime a Iterator<Item=String> of is parsed to a program and it returns a structure containing parameter argument pairings
  • Very little validation is done, it is upto the user to check required parameters are present and strings are parsed into their required forms

Linting

During runtime the definition is not checked. Therefore it can have multiple problems

  • Invalid endpoint or argument name. e.g. empty or contains whitespace
  • Positional parameter after positional parameter accepting multiple (unreachable)

To catch these errors you can run CLI::lint as a test

Future

  • Run lint on debug_assertions?
  • Lifetime on CLI (rather than 'static)
  • More checking in this library
  • struct + derive-macro API with FromString logic
  • Shorthand named parameter
  • Auto-completion generation for shells (Powershell, Bash, Fish etc)
  • JavaScript library that mirrors Rust API
  • Replace HashSet in unique lookup?