fpco / stackage-cli

MIT License
28 stars 4 forks source link

Stackage.CLI library #2

Closed chrisdone closed 9 years ago

chrisdone commented 9 years ago

Make a small library in the .cabal stackage-cli package with a module Stackage.CLI which exports a wrapper to optparse-applicative or similar with a preconfigured way of listing a summary (--summary probably) line of help.

Then the main executable can import this module to determine the correct prefix (--summary probably) to pass to the plugin commands to get a line for its --help display.

chrisdone commented 9 years ago

This library can also expose the means to find plugins (via a Text string) and execute them, returning a status code at the end. Then the main stackage binary (#3) has little work to do. This will be handy for plugins that call other plugins. To be clear: Given the dynamic nature of whether plugins are available or not, it should be treated as a Text lookup, not as a static import of a library.

chrisdone commented 9 years ago

Remaining items:

chrisdone commented 9 years ago

@DanBurton I fixed item one in https://github.com/fpco/stackage-cli/commit/e91fcf275f88c93eeb2ea11da22730c522d22302 and 220ae05. I think you're good on the second point.

DanBurton commented 9 years ago

Running commands via Stackage.CLI.runStackagePlugin allows stdin/stdout interaction. In the repo's current state, I can build and correctly interact with the stackage purge command.

DanBurton commented 9 years ago

Should be ready to close.

chrisdone commented 9 years ago

Confirmed in purge