-- Generated by scripts/generate.mjs. Do not edit. module Dagger.File ( asEnvFile , asEnvFileWith , AsEnvFileOpts , defaultAsEnvFileOpts , asGitBundle , asJSON , chown , contents , contentsWith , ContentsOpts , defaultContentsOpts , digest , digestWith , DigestOpts , defaultDigestOpts , export , exportWith , ExportOpts , defaultExportOpts , id , name , search , searchWith , SearchOpts , defaultSearchOpts , size , stat , sync , withName , withReplaced , withReplacedWith , WithReplacedOpts , defaultWithReplacedOpts , withTimestamps ) where import Data.Maybe (Maybe(..)) import Effect.Aff (Aff) import Dagger.Internal.Runtime as R import Dagger.Types as T type AsEnvFileOpts = { expand :: Maybe Boolean } defaultAsEnvFileOpts :: AsEnvFileOpts defaultAsEnvFileOpts = { expand: Nothing } -- | Parse as an env file asEnvFile :: T.File -> T.EnvFile asEnvFile = asEnvFileWith defaultAsEnvFileOpts -- | Parse as an env file asEnvFileWith :: AsEnvFileOpts -> T.File -> T.EnvFile asEnvFileWith opts = R.select "asEnvFile" [R.optional (R.argument "expand" "Boolean") opts.expand] -- | Interpret this file as a Git bundle by lazily parsing its header. asGitBundle :: T.File -> T.GitBundle asGitBundle = R.select "asGitBundle" [] -- | Parse the file contents as JSON. asJSON :: T.File -> T.JSONValue asJSON = R.select "asJSON" [] -- | Change the owner of the file recursively. chown :: String -> T.File -> T.File chown argOwner = R.select "chown" [R.argument "owner" "String!" argOwner] type ContentsOpts = { offsetLines :: Maybe Int , limitLines :: Maybe Int } defaultContentsOpts :: ContentsOpts defaultContentsOpts = { offsetLines: Nothing , limitLines: Nothing } -- | Retrieves the contents of the file. contents :: T.File -> Aff String contents = contentsWith defaultContentsOpts -- | Retrieves the contents of the file. contentsWith :: ContentsOpts -> T.File -> Aff String contentsWith opts = R.scalar "contents" [R.optional (R.argument "offsetLines" "Int") opts.offsetLines, R.optional (R.argument "limitLines" "Int") opts.limitLines] type DigestOpts = { excludeMetadata :: Maybe Boolean } defaultDigestOpts :: DigestOpts defaultDigestOpts = { excludeMetadata: Nothing } -- | 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. digest :: T.File -> Aff String digest = digestWith defaultDigestOpts -- | 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. digestWith :: DigestOpts -> T.File -> Aff String digestWith opts = R.scalar "digest" [R.optional (R.argument "excludeMetadata" "Boolean") opts.excludeMetadata] type ExportOpts = { allowParentDirPath :: Maybe Boolean } defaultExportOpts :: ExportOpts defaultExportOpts = { allowParentDirPath: Nothing } -- | Writes the file to a file path on the host. export :: String -> T.File -> Aff String export argPath = exportWith argPath defaultExportOpts -- | Writes the file to a file path on the host. exportWith :: String -> ExportOpts -> T.File -> Aff String exportWith argPath opts = R.scalar "export" [R.argument "path" "String!" argPath, R.optional (R.argument "allowParentDirPath" "Boolean") opts.allowParentDirPath] -- | A unique identifier for this File. id :: T.File -> Aff T.ID id = R.scalar "id" [] -- | Retrieves the name of the file. name :: T.File -> Aff String name = R.scalar "name" [] type SearchOpts = { literal :: Maybe Boolean , multiline :: Maybe Boolean , dotall :: Maybe Boolean , insensitive :: Maybe Boolean , skipIgnored :: Maybe Boolean , skipHidden :: Maybe Boolean , filesOnly :: Maybe Boolean , limit :: Maybe Int , paths :: Maybe (Array String) , globs :: Maybe (Array String) } defaultSearchOpts :: SearchOpts defaultSearchOpts = { literal: Nothing , multiline: Nothing , dotall: Nothing , insensitive: Nothing , skipIgnored: Nothing , skipHidden: Nothing , filesOnly: Nothing , limit: Nothing , paths: Nothing , globs: Nothing } -- | Searches for content matching the given regular expression or literal string. -- | -- | Uses Rust regex syntax; escape literal ., [, ], {, }, | with backslashes. search :: String -> T.File -> Aff (Array T.SearchResult) search argPattern = searchWith argPattern defaultSearchOpts -- | Searches for content matching the given regular expression or literal string. -- | -- | Uses Rust regex syntax; escape literal ., [, ], {, }, | with backslashes. searchWith :: String -> SearchOpts -> T.File -> Aff (Array T.SearchResult) searchWith argPattern opts = R.objectList "SearchResult" "search" [R.argument "pattern" "String!" argPattern, R.optional (R.argument "literal" "Boolean") opts.literal, R.optional (R.argument "multiline" "Boolean") opts.multiline, R.optional (R.argument "dotall" "Boolean") opts.dotall, R.optional (R.argument "insensitive" "Boolean") opts.insensitive, R.optional (R.argument "skipIgnored" "Boolean") opts.skipIgnored, R.optional (R.argument "skipHidden" "Boolean") opts.skipHidden, R.optional (R.argument "filesOnly" "Boolean") opts.filesOnly, R.optional (R.argument "limit" "Int") opts.limit, R.optional (R.argument "paths" "[String!]") opts.paths, R.optional (R.argument "globs" "[String!]") opts.globs] -- | Retrieves the size of the file, in bytes. size :: T.File -> Aff Int size = R.scalar "size" [] -- | Return file status stat :: T.File -> Aff (Maybe T.Stat) stat = R.nullableObject "Stat" "stat" [] -- | Force evaluation in the engine. sync :: T.File -> Aff T.ID sync = R.scalar "sync" [] -- | Retrieves this file with its name set to the given name. withName :: String -> T.File -> T.File withName argName = R.select "withName" [R.argument "name" "String!" argName] type WithReplacedOpts = { all :: Maybe Boolean , firstFrom :: Maybe Int } defaultWithReplacedOpts :: WithReplacedOpts defaultWithReplacedOpts = { all: Nothing , firstFrom: Nothing } -- | 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. withReplaced :: String -> String -> T.File -> T.File withReplaced argSearch argReplacement = withReplacedWith argSearch argReplacement defaultWithReplacedOpts -- | 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. withReplacedWith :: String -> String -> WithReplacedOpts -> T.File -> T.File withReplacedWith argSearch argReplacement opts = R.select "withReplaced" [R.argument "search" "String!" argSearch, R.argument "replacement" "String!" argReplacement, R.optional (R.argument "all" "Boolean") opts.all, R.optional (R.argument "firstFrom" "Int") opts.firstFrom] -- | Retrieves this file with its created/modified timestamps set to the given time. withTimestamps :: Int -> T.File -> T.File withTimestamps argTimestamp = R.select "withTimestamps" [R.argument "timestamp" "Int!" argTimestamp]