Add mkdir docs
Signed-off-by: Vasek - Tom C <tom.chauveau@epitech.eu>
This commit is contained in:
parent
d2580f4a73
commit
e11cb1b6fd
@ -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._
|
||||||
|
@ -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.
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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"
|
||||||
|
@ -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
|
||||||
|
Reference in New Issue
Block a user