Overview

flitter-cli provides a number of CLI tools for Flitter with the goal of making the Flitter development flow easier. In Flitter, this functionality is made available in the form of the ./flitter command.

This command exposes an endpoint for the flitter-cli logic, and is usually formatted like so:

#!/usr/bin/env node
/*
 * ./flitter
 * -------------------------------------------------------------
 * The ./flitter command is used to interact with Flitter and its tools
 * in the development environment. Currently, it lends access to Flitter
 * shell, which is like a Node interactive prompt, but it's launched from
 * within the same context as the Flitter HTTP server, allowing developers
 * to interact with Flitter directly.
 */
const CliUnit = require('flitter-cli/CliUnit')
const cli = new CliUnit()

/*
 * Since the ./flitter command loads a full, running instance of
 * Flitter, it also uses the Flitter units file. The only difference
 * is that the CliUnit replaces the final AppUnit with InteractiveUnit,
 * which launches the interactive prompt.
 */
const units = require('./Units.flitter')

/*
 * process the command line arguments and interpret the given
 * directives.
 */
cli.interpreter(units)

This expects the file to be called with command line inputs, which flitter-cli processes then handles.

No Comments
Back to top