dagger/dsl/file

Types

pub type Opts {
  Opts(
    permissions: option.Option(Int),
    offset_lines: option.Option(Int),
    limit_lines: option.Option(Int),
    exclude_metadata: option.Option(Bool),
    allow_parent_dir_path: option.Option(Bool),
    literal: option.Option(Bool),
    multiline: option.Option(Bool),
    dotall: option.Option(Bool),
    insensitive: option.Option(Bool),
    skip_ignored: option.Option(Bool),
    skip_hidden: option.Option(Bool),
    files_only: option.Option(Bool),
    limit: option.Option(Int),
    paths: option.Option(List(String)),
    globs: option.Option(List(String)),
    all: option.Option(Bool),
    first_from: option.Option(Int),
  )
}

Constructors

Values

pub fn all(opts: Opts, val: Bool) -> Opts
pub fn allow_parent_dir_path(opts: Opts, val: Bool) -> Opts
pub fn as_env_file(parent: types.File) -> types.EnvFile

Parse as an env file

pub fn as_j_s_o_n(parent: types.File) -> types.JSONValue

Parse the file contents as JSON.

pub fn chown(
  parent: types.File,
  owner owner: String,
) -> types.File

Change the owner of the file recursively.

pub fn contents(
  parent: types.File,
  with with_fn: fn(Opts) -> Opts,
  client client: types.Client,
  then handler: fn(Result(String, types.QueryError)) -> a,
) -> a

Retrieves the contents of the file.

pub fn digest(
  parent: types.File,
  with with_fn: fn(Opts) -> Opts,
  client client: types.Client,
  then handler: fn(Result(String, types.QueryError)) -> a,
) -> a

Return the file’s digest. The format of the digest is not guaranteed to be stable between releases of Dagger. It is guaranteed to be stable between invocations of the same Dagger engine.

pub fn dotall(opts: Opts, val: Bool) -> Opts
pub fn exclude_metadata(opts: Opts, val: Bool) -> Opts
pub fn export(
  parent: types.File,
  path path: String,
  with with_fn: fn(Opts) -> Opts,
  client client: types.Client,
  then handler: fn(Result(String, types.QueryError)) -> a,
) -> a

Writes the file to a file path on the host.

pub fn file(
  name name: String,
  contents contents: String,
  with with_fn: fn(Opts) -> Opts,
) -> types.File
pub fn files_only(opts: Opts, val: Bool) -> Opts
pub fn first_from(opts: Opts, val: Int) -> Opts
pub fn globs(opts: Opts, val: List(String)) -> Opts
pub fn id(parent: types.File) -> types.File

A unique identifier for this File.

pub fn insensitive(opts: Opts, val: Bool) -> Opts
pub fn limit(opts: Opts, val: Int) -> Opts
pub fn limit_lines(opts: Opts, val: Int) -> Opts
pub fn literal(opts: Opts, val: Bool) -> Opts
pub fn multiline(opts: Opts, val: Bool) -> Opts
pub fn name(
  parent: types.File,
  client client: types.Client,
  then handler: fn(Result(String, types.QueryError)) -> a,
) -> a

Retrieves the name of the file.

pub fn none(opts: Opts) -> Opts
pub fn offset_lines(opts: Opts, val: Int) -> Opts
pub fn paths(opts: Opts, val: List(String)) -> Opts
pub fn permissions(opts: Opts, val: Int) -> Opts
pub fn search(
  parent: types.File,
  pattern pattern: String,
  with with_fn: fn(Opts) -> Opts,
  select select: fn(types.SearchResult) -> List(types.Field),
  client client: types.Client,
  then handler: fn(
    Result(List(types.SearchResult), types.QueryError),
  ) -> a,
) -> a

Searches for content matching the given regular expression or literal string. Uses Rust regex syntax; escape literal ., [, ], {, }, | with backslashes.

pub fn size(
  parent: types.File,
  client client: types.Client,
  then handler: fn(Result(Int, types.QueryError)) -> a,
) -> a

Retrieves the size of the file, in bytes.

pub fn skip_hidden(opts: Opts, val: Bool) -> Opts
pub fn skip_ignored(opts: Opts, val: Bool) -> Opts
pub fn stat(parent: types.File) -> types.Stat

Return file status

pub fn sync(parent: types.File) -> types.File

Force evaluation in the engine.

pub fn with_name(
  parent: types.File,
  name name: String,
) -> types.File

Retrieves this file with its name set to the given name.

pub fn with_replaced(
  parent: types.File,
  search search: String,
  replacement replacement: String,
  with with_fn: fn(Opts) -> Opts,
) -> types.File

Retrieves the file with content replaced with the given text. If ‘all’ is true, all occurrences of the pattern will be replaced. If ‘firstAfter’ is specified, only the first match starting at the specified line will be replaced. If neither are specified, and there are multiple matches for the pattern, this will error. If there are no matches for the pattern, this will error.

pub fn with_timestamps(
  parent: types.File,
  timestamp timestamp: Int,
) -> types.File

Retrieves this file with its created/modified timestamps set to the given time.

Search Document