#directory not passed as argument.

1 messages · Page 1 of 1 (latest)

vital elbow
#

Hello.
I have a module that I will upload in the daggerverse.

it includes this functions:

  @func()
  async executeZshFunction(
    @argument({ defaultPath: "./scripts" }) scripts: Directory,
    @argument({ defaultPath: "./" }) gitRoot: Directory,
    functionToCall: string
  ): Promise<string> {
    return this.buildZshContainer(scripts)
      .withMountedDirectory(mountGitRoot, gitRoot)
      .withWorkdir(mountGitRoot + "/..")
      .withExec(["git", "checkout", "-f"])
      .terminal()
      .withExec(["/bin/zsh", "-c", 'source /scripts/allSources; ' + functionToCall])
      .stdout(); // execute the command and return the output
  }

the thing is the script is part of the module that is uploaded in the daggerverse and I do not want to actually have it as an argument.

how can I transform the function without taking the script folder as an argument ?

@func()
async executeZshFunction(
@argument({ defaultPath: "./" }) gitRoot: Directory,
functionToCall: string
): Promise<string> {

const scripts: Directory = ????

return this.buildZshContainer(scripts)
  .withMountedDirectory(mountGitRoot, gitRoot)
  .withWorkdir(mountGitRoot + "/..")
  .withExec(["git", "checkout", "-f"])
  .terminal()
  .withExec(["/bin/zsh", "-c", 'source /scripts/allSources; ' + functionToCall])
  .stdout(); // execute the command and return the output

}

thank you

vital elbow
#

sorry I found the answer:
return dag.currentModule().source().directory("./scripts")