Expand description
Synthesizing clap commands from a cassette surface, and resolving them back into calls.
Every generated command is built here rather than derived, because the set
is not known until a server has been asked. The shape deliberately matches
a consumer’s hand-written surface — <noun> <method>, whatever shared
flags the consumer decorates on, and the server’s JSON printed verbatim —
so a cassette command is not visibly a second-class citizen next to a
hand-written one.
§The consumer executes
This module stops at resolve_invocation, which turns a parsed match
back into the Method it names and the Call to make. Executing the
call and printing the response stay with the consumer: tapesctl reads its
own --tapes-url flag (added through the augment decorator), builds
its client, and prints the way its hand-written commands do.
Functions§
- augment
- Add a subcommand for every cassette on the surface.
- call_
for - Assemble the request for a matched method.
- cassette_
command - The subcommand for one cassette.
- method_
command - The subcommand for one method.
- read_
body - Resolve a
--bodyvalue, which is either JSON or@<path>. - resolve_
invocation - Resolve a matched cassette invocation back into the method it names and the call to make.