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

View File

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

View File

@ -150,7 +150,7 @@ _No output._
## engine.#Mkdir
Create a directory
Create one or multiple directory in a container Create a directory
### 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
outputFs := pctx.FS.New(result)
outputFS := pctx.FS.New(result)
// Init output
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 output, nil

View File

@ -1,20 +1,23 @@
package engine
// Read a file from a filesystem tree
// Create one or multiple directory in a container
#Mkdir: {
$dagger: task: _name: "Mkdir"
// Container filesystem
input: #FS
// Path of the directory
// Path of the directory to create
// It can be nested (e.g : "/foo" or "/foo/bar")
path: string
// Permission to set
// Permissions to set
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
// Modified filesystem
output: #FS
}
@ -57,23 +60,6 @@ package engine
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: {
$dagger: task: _name: "Copy"

View File

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

View File

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

View File

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

View File

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