Add mkdir docs

Signed-off-by: Vasek - Tom C <tom.chauveau@epitech.eu>
This commit is contained in:
Vasek - Tom C 2021-12-17 22:17:06 +01:00
parent d2580f4a73
commit e11cb1b6fd
No known key found for this signature in database
GPG Key ID: 175D82E572427960
9 changed files with 36 additions and 41 deletions

View File

@ -152,7 +152,7 @@ _No output._
## engine.#Mkdir ## engine.#Mkdir
Create a directory Create one or multiple directory in a container
### engine.#Mkdir Inputs ### engine.#Mkdir Inputs
@ -212,8 +212,6 @@ _No output._
## engine.#ReadFile ## engine.#ReadFile
Read a file from a filesystem tree
### engine.#ReadFile Inputs ### engine.#ReadFile Inputs
_No input._ _No input._

View File

@ -56,6 +56,18 @@ _No input._
_No output._ _No output._
## engine.#Mkdir
Create one or multiple directory in a container
### engine.#Mkdir Inputs
_No input._
### engine.#Mkdir Outputs
_No output._
## engine.#Mount ## engine.#Mount
A transient filesystem mount. A transient filesystem mount.

View File

@ -150,7 +150,7 @@ _No output._
## engine.#Mkdir ## engine.#Mkdir
Create a directory Create one or multiple directory in a container Create a directory
### engine.#Mkdir Inputs ### engine.#Mkdir Inputs

View File

@ -69,12 +69,12 @@ func (t *mkdirTask) Run(ctx context.Context, pctx *plancontext.Context, s solver
} }
// Retrieve result result filesystem // Retrieve result result filesystem
outputFs := pctx.FS.New(result) outputFS := pctx.FS.New(result)
// Init output // Init output
output := compiler.NewValue() output := compiler.NewValue()
if err := output.FillPath(cue.ParsePath("output"), outputFs.MarshalCUE()); err != nil { if err := output.FillPath(cue.ParsePath("output"), outputFS.MarshalCUE()); err != nil {
return nil, err return nil, err
} }
return output, nil return output, nil

View File

@ -1,20 +1,23 @@
package engine package engine
// Read a file from a filesystem tree // Create one or multiple directory in a container
#Mkdir: { #Mkdir: {
$dagger: task: _name: "Mkdir" $dagger: task: _name: "Mkdir"
// Container filesystem
input: #FS input: #FS
// Path of the directory // Path of the directory to create
// It can be nested (e.g : "/foo" or "/foo/bar")
path: string path: string
// Permission to set // Permissions to set
mode: *0o755 | int mode: *0o755 | int
// Create parents' directory if they do not exist // If set, it creates parents' directory if they do not exist
parents: *true | false parents: *true | false
// Modified filesystem
output: #FS output: #FS
} }
@ -57,23 +60,6 @@ package engine
output: #FS output: #FS
} }
// Create a directory
#Mkdir: {
@dagger(notimplemented)
$dagger: task: _name: "Mkdir"
input: #FS
// Path of the directory
path: string
// FIXME: permissions?
mode: int
// Create parent directories as needed?
parents: *true | false
output: #FS
}
// Copy files from one FS tree to another // Copy files from one FS tree to another
#Copy: { #Copy: {
$dagger: task: _name: "Copy" $dagger: task: _name: "Copy"

View File

@ -58,16 +58,15 @@ setup() {
@test "task: #Mkdir" { @test "task: #Mkdir" {
# Make directory
cd "$TESTDIR"/tasks/mkdir cd "$TESTDIR"/tasks/mkdir
"$DAGGER" --europa up ./mkdir.cue "$DAGGER" --europa up ./mkdir.cue
}
@test "task: #Mkdir: create parents" { # Create parents
cd "$TESTDIR"/tasks/mkdir cd "$TESTDIR"/tasks/mkdir
"$DAGGER" --europa up ./mkdir_parents.cue "$DAGGER" --europa up ./mkdir_parents.cue
}
@test "task: #Mkdir failure: disable parents creation" { # Disable parents creation
cd "$TESTDIR"/tasks/mkdir cd "$TESTDIR"/tasks/mkdir
run "$DAGGER" --europa up ./mkdir_failure_disable_parents.cue run "$DAGGER" --europa up ./mkdir_failure_disable_parents.cue
assert_failure assert_failure

View File

@ -12,7 +12,7 @@ engine.#Plan & {
mkdir: engine.#Mkdir & { mkdir: engine.#Mkdir & {
input: image.output input: image.output
path: "/test" path: "/test"
} }
writeChecker: engine.#WriteFile & { writeChecker: engine.#WriteFile & {
@ -24,10 +24,10 @@ engine.#Plan & {
readChecker: engine.#ReadFile & { readChecker: engine.#ReadFile & {
input: writeChecker.output input: writeChecker.output
path: "/test/foo" path: "/test/foo"
} & { } & {
// assert result // assert result
contents: "bar" contents: "bar"
} }
} }
} }

View File

@ -11,8 +11,8 @@ engine.#Plan & {
} }
mkdir: engine.#Mkdir & { mkdir: engine.#Mkdir & {
input: image.output input: image.output
path: "/test/baz" path: "/test/baz"
parents: false parents: false
} }
@ -25,10 +25,10 @@ engine.#Plan & {
readChecker: engine.#ReadFile & { readChecker: engine.#ReadFile & {
input: writeChecker.output input: writeChecker.output
path: "/test/baz/foo" path: "/test/baz/foo"
} & { } & {
// assert result // assert result
contents: "bar" contents: "bar"
} }
} }
} }

View File

@ -12,7 +12,7 @@ engine.#Plan & {
mkdir: engine.#Mkdir & { mkdir: engine.#Mkdir & {
input: image.output input: image.output
path: "/test/baz" path: "/test/baz"
} }
writeChecker: engine.#WriteFile & { writeChecker: engine.#WriteFile & {
@ -24,10 +24,10 @@ engine.#Plan & {
readChecker: engine.#ReadFile & { readChecker: engine.#ReadFile & {
input: writeChecker.output input: writeChecker.output
path: "/test/baz/foo" path: "/test/baz/foo"
} & { } & {
// assert result // assert result
contents: "bar" contents: "bar"
} }
} }
} }