Skip to content

[#110] Move CLI parsing helpers to the library

Ivan Gromakovskii requested to merge gromak/#110-parsing-helpers into master

Description

Problem: we have some generally useful things like addressOption and maybeAddDefault in Main, they can't be reused in other packages and we tend to copy-paste. Also some code for CLI parsing is in private repos, we'd like to open source it.

Solution: create Util.Named, move maybeAddDefault there along with numeruous parsers. Also add namedParser there, we do not use it in morley, but it is used in several private repos and is generally useful, so we want to open-source and reuse it. Note: outputOption is not there because "Nothing means stdout" behavior is not quite conventional one, AFAIK it's common to pass - to request stdout.

Related issue(s)

Resolves #110 (closed)

Checklist for your Merge Request

Related changes (conditional)

  • Tests (see short guidelines)

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:
    • I updated changelog files of all affected packages released to Hackage if my changes are externally visible.

Stylistic guide (mandatory)

Edited by Ivan Gromakovskii

Merge request reports