gleamoire/args

Types

pub type Args {
  Help
  PrintVersion
  Document(
    query: ParsedQuery,
    print_mode: PrintMode,
    cache_path: Option(String),
    package_version: Option(Version),
    refresh_cache: Bool,
    print_raw: Bool,
  )
}

Constructors

  • Help
  • PrintVersion
  • Document(
      query: ParsedQuery,
      print_mode: PrintMode,
      cache_path: Option(String),
      package_version: Option(Version),
      refresh_cache: Bool,
      print_raw: Bool,
    )

Holds parsed values from user query

pub type ParsedQuery {
  ParsedQuery(
    package: Option(String),
    module_path: List(String),
    item: Option(String),
  )
}

Constructors

  • ParsedQuery(
      package: Option(String),
      module_path: List(String),
      item: Option(String),
    )
pub type PrintMode {
  Unspecified
  Type
  Value
}

Constructors

  • Unspecified
  • Type
  • Value

Constants

pub const help_text: String

Functions

pub fn parse_args(args: List(String)) -> Result(Args, Error)

Parse a list of strings into structured arguments

pub fn parse_query(query: String) -> Result(ParsedQuery, Error)

Turns an arbitrary string into a parsed query The expected input looks like this: [package:]module/name[.item] Parts between brackets can be ommited

Search Document