cquill/cli/args

Types

Top-level CLI command

pub type Command {
  Generate(GenerateOptions)
  Help
  Version
}

Constructors

  • Generate(GenerateOptions)

    Generate Gleam code from database schema

  • Help

    Show help message

  • Version

    Show version

Options for the generate command

pub type GenerateOptions {
  GenerateOptions(
    database_url: String,
    output: String,
    schema: String,
    tables: option.Option(String),
    exclude: option.Option(String),
    prefix: String,
    watch: Bool,
    poll_interval: Int,
    format: Bool,
    dry_run: Bool,
    verbose: Bool,
    typed: Bool,
  )
}

Constructors

  • GenerateOptions(
      database_url: String,
      output: String,
      schema: String,
      tables: option.Option(String),
      exclude: option.Option(String),
      prefix: String,
      watch: Bool,
      poll_interval: Int,
      format: Bool,
      dry_run: Bool,
      verbose: Bool,
      typed: Bool,
    )

    Arguments

    database_url

    Database connection URL (required)

    output

    Output directory for generated files

    schema

    Database schema to introspect

    tables

    Comma-separated list of tables to include (None = all tables)

    exclude

    Comma-separated list of tables to exclude

    prefix

    Module prefix for generated code

    watch

    Watch for schema changes and regenerate

    poll_interval

    Polling interval in milliseconds for watch mode

    format

    Run gleam format after generation

    dry_run

    Show what would be generated without writing

    verbose

    Enable verbose output

    typed

    Generate typed columns for type-safe query builder

Errors that can occur during argument parsing

pub type ParseError {
  MissingRequired(name: String)
  InvalidValue(name: String, value: String, reason: String)
  UnknownCommand(name: String)
  MissingValue(name: String)
  UnknownOption(name: String)
}

Constructors

  • MissingRequired(name: String)

    Missing required argument

  • InvalidValue(name: String, value: String, reason: String)

    Invalid argument value

  • UnknownCommand(name: String)

    Unknown command

  • MissingValue(name: String)

    Missing value for option

  • UnknownOption(name: String)

    Unknown option

Values

pub fn default_generate_options() -> GenerateOptions

Create default generate options

pub const default_output: String

Default output directory

pub const default_poll_interval: Int

Default poll interval in milliseconds (5 seconds)

pub const default_prefix: String

Default module prefix

pub const default_schema: String

Default database schema

pub fn format_error(error: ParseError) -> String

Format a parse error for display

pub fn help_text() -> String

Generate the main help text

pub fn parse(args: List(String)) -> Result(Command, ParseError)

Parse command line arguments into a Command

pub fn parse_table_list(
  input: option.Option(String),
) -> List(String)

Parse a comma-separated list of table names

pub fn should_include_table(
  table_name: String,
  include_tables: List(String),
  exclude_tables: List(String),
) -> Bool

Check if a table should be included based on include/exclude lists

pub fn version_text() -> String

Get version string

Search Document